I dont want to waste anybodys time here but i will upload a sample of my xml file and the code i am trying to use to parse it, if anybody can tell me what im doing wrong i would be insanely grateful
xml sample:
I am trying to extract the PurchaseOrderUnitId ident attrib number, and the PurchaseOrderUnitQty, they eventually need formatted like this 6 digit id number/+Qty. But right now im just trying to pull the numbers out of the xml file
With this code:
import xml.etree.cElementTree as ET
tree = ET.ElementTree(file="c:\\users\\design\\desktop\\scripttest\\newsample.xml")
root = tree.getroot()
for PurchaseOrderUnit in root.findall('PurchaseOrderUnit'):
qty = PurchaseOrderUnit.findall('PurchaseOrderUnitQty').text
id = PurchaseOrderUnit.get('PurchaseOrderUnitId')
print id, qty
when i run it from the command prompt it doesnt output anything, no errors or nothing.
Comments
No Comments Exist
Be the first, drop a comment!