Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
Received, but not all. Here is the code that selects attributes, but not from a nested
tag
import xml.etree.ElementTree as ET
tree = ET.parse('/LAS.xml')
root = tree.getroot()
lst = list()
for child in root:
for item in child.attrib:
if item not in lst:
lst.append(item)
print(lst)
<?xml version="1.0" encoding="utf-8"?>
<packetinfo>
<client syncid="18492745" action="set" is_carrier="f" comments="">
</client>
<sku syncid="18492746" producer="" barcode="4627109384174" need_weight="">
</sku>
<order syncid="18492747" qty="1" uom="ШТ" warehouse_id="10" shipment="МОСКВА">
<order_detail syncid="18492748" comments="">
</order_detail>
</order>
</packetinfo>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question