Skip to content

Instantly share code, notes, and snippets.

@takaki
Created October 11, 2012 05:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save takaki/3870297 to your computer and use it in GitHub Desktop.
Save takaki/3870297 to your computer and use it in GitHub Desktop.
simple example for parse gnucash xml by lxml
#!/usr/bin/python
from lxml import etree
import gzip
tree = etree.parse(gzip.open('personal.gnucash'))
root = tree.getroot()
for i in tree.xpath('//gnc:GncInvoice[invoice:id[text()="000003"]]',namespaces=root.nsmap):
print(i.tag)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment