Extracting xml from html

Stefan Behnel stefan.behnel-n05pAM at web.de
Wed Sep 19 12:24:38 EDT 2007


kyosohma at gmail.com wrote:
>>    row = tree.find("//Row")
>>    print row.findtext("primaryowner")
>>    print row.findtext("customeraddress")
> 
> I tried this your way and Laurent's way and both give me this error:
> 
> AttributeError: 'NoneType' object has no attribute 'findtext'

Well, error handling is up to you. If find() doesn't find what you are looking
for, it will return None. Note that tag names are case sensitive - or maybe
there are namespaces involved, cannot tell from the example you posted.

Stefan



More information about the Python-list mailing list