Created
March 7, 2019 09:47
-
-
Save BitAndQuark/d044e63060b5bd04ecaa4a1e03a3efe3 to your computer and use it in GitHub Desktop.
Use lxml to parse xml QC logs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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