Search This Blog

Python: parse xml using ElementTree

  • parse from a file:
    import xml.etree.ElementTree as ET
    tree = ET.parse('/home/wilson/my.xml')
    root = tree.getroot()
  • parse from a string:
    import xml.etree.ElementTree as ET
    root = ET.fromstring('1')


see also

No comments:

Post a Comment