SHARE
TWEET

JV

a guest Dec 19th, 2008 64 Never
  1. In [51]: from elementtree import ElementTree as et
  2.  
  3. In [52]: s
  4. Out[52]: '<p>blah <b>bleh</b> blih</p>'
  5.  
  6. In [53]: t=et.fromstring(s)
  7.  
  8. In [54]: " ".join( [ t.tostring() for t in t.findall('*') ] )
  9. ---------------------------------------------------------------------------
  10. <type 'exceptions.AttributeError'>        Traceback (most recent call last)
  11.  
  12. /home/jv/KnowledgeMate/KnowledgeMate/<ipython console> in <module>()
  13.  
  14. <type 'exceptions.AttributeError'>: _ElementInterface instance has no attribute 'tostring'
RAW Paste Data
Top