Skip to content

Instantly share code, notes, and snippets.

@wpjunior
Created May 28, 2020 22:10
Show Gist options
  • Save wpjunior/1757eee436e06177ecdf5ff4bb422173 to your computer and use it in GitHub Desktop.
Save wpjunior/1757eee436e06177ecdf5ff4bb422173 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import xml.etree.ElementTree as ET
tree = ET.parse(sys.argv[1])
root = tree.getroot()
nfe = root.findall("{http://www.portalfiscal.inf.br/nfe}NFe")[0]
icms = nfe.findall('.//{http://www.portalfiscal.inf.br/nfe}ICMS70/{http://www.portalfiscal.inf.br/nfe}vICMS')
for i in icms:
print(i.text)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment