Я хотел бы удалить их
Однако я не могу получить доступ к родительскому элементу, чтобы удалить его
Код: Выделить всё
file = open('test.xml', "r")
elem = ElementTree.parse(file)
namespace = "{http://somens}"
props = elem.findall('.//{0}prop'.format(namespace))
for prop in props:
type = prop.attrib.get('type', None)
if type == 'json':
value = json.loads(prop.attrib['value'])
if value['name'] == 'Page1.Button1':
#here I need to access the parent of prop
# in order to delete the prop
Спасибо
Подробнее здесь: https://stackoverflow.com/questions/684 ... -in-python
Мобильная версия