fork download
  1. from lxml import etree
  2. from io import BytesIO
  3. f=open('....\xmltest2.xml')
  4. xml=f.read()
  5. print (xml)
  6. string2="//port"+"[state[@reason_ttl='1']]"
  7. nodes_nmap=tree.xpath(string2)
  8. print (nodes_nmap)
  9. for node in nodes_nmap:
  10. print (node.values())
Runtime error #stdin #stdout #stderr 0.03s 44680KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Traceback (most recent call last):
  File "<builtin>/app_main.py", line 75, in run_toplevel
ValueError: invalid \x escape