dec_xml_parser.py 347 B

1234567891011121314
  1. '''Created Mar 18, 2021 Levi'''
  2. from xml.etree import ElementTree as ET
  3. import xlsxwriter as xlsw
  4. import openpyxl as xl
  5. xml = ET.parse('D390_2020_10_21480386.xml')
  6. root = xml.getroot()
  7. data = []
  8. for ch in root:
  9. if 'tip' in ch.attrib:
  10. d = {root.attrib['cui']: [ch.attrib['tip'], ch.attrib['tara']]}
  11. data.append(d)
  12. print(data)