parse xml
Adam Tauno Williams
awilliam at whitemice.org
Mon Oct 3 08:02:19 EDT 2011
Quoting 守株待兔 <1248283536 at qq.com>:
> please click the
> http://www.secinfo.com/d14qfp.q9j.htm
> then ,click the following:
> 44: XML IDEA: Condensed Consolidating Statements of Income XML
> 5.11M (Details)--R158
> there is the citigroup's annual financial report --statements of
> income,xml file.
> how can i get a table of statements of income in python ?
Read the document with etree, and either iterate over it or grab the
required values with xpath.
from lxml import etree
doc = etree.parse(self.rfile)
result = doc.xpath(self._xpath, namespaces=doc.getroot().nsmap)
More information about the Python-list
mailing list