ElementTree surprise

Paul Rubin http
Thu Aug 16 03:33:26 EDT 2007


Stefan Behnel <stefan.behnel-n05pAM at web.de> writes:
> So it's not even an ElementTree thing. ET just doesn't know what
> exactly was in the original XML byte stream. A very simple way to
> make sure you always get a string back is
>     >>> text = element.text or ""

Thanks, I ended up doing something like that.  What I wondered about
the standard was whether it specified that parrot had no text node,
as opposed to having an empty text node.  I guess it doesn't matter,
it just caught me by surprise.



More information about the Python-list mailing list