Skip to content

Instantly share code, notes, and snippets.

@BitAndQuark
Created March 7, 2019 09:47
Show Gist options
  • Save BitAndQuark/d044e63060b5bd04ecaa4a1e03a3efe3 to your computer and use it in GitHub Desktop.
Save BitAndQuark/d044e63060b5bd04ecaa4a1e03a3efe3 to your computer and use it in GitHub Desktop.
Use lxml to parse xml QC logs
import lxml.html
from lxml import etree
root = etree.fromstring(open('UserDefine-UUT ID-2019_02_27_01_51_00_179--00_P.xml').read())
# Get all "Test" nodes
root.xpath('//Test')
# Get date stamp
'/'.join((root.xpath('./*[1]/Date/YYYY')[0].text, root.xpath('./*[1]/Date/MM')[0].text, root.xpath('./*[1]/Date/DD')[0].text))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment