import xml.etree.ElementTree as ET
xml = """<?xml version="1.0"?>
<data>
<string name="contact">Обратная связь</string>
<string name="key1">Отключить</string>
</data>"""
# tree = ET.parse(strings)
# root = tree.getroot()
root = ET.fromstring(xml)
for child in root:
key = child.attrib # key in name=""
value = child.text # content in <string></string>
# print(key,value)
child.text = 'HI'
print(ET.tostring(root,encoding="unicode"))