[Tutor] Convert XML codes to "normal" text?

Lie Ryan lie.1296 at gmail.com
Wed Mar 4 07:27:29 CET 2009


Eric Dorsey wrote:
> _So here is my program, I'm pulling some information off of my Snipt 
> feed .._

<snip>

> I know, for example, that the &gt; code means >, but what I don't know 
> is how to convert it in all my data to show properly? In all the 
> feedparser examples it just smoothly has the output correct 

Why not str.replace()?

mystring = mystring.replace('&gt;', '>')

> (like in one 
> the data was <span>whatever</span> and it had the special characters 
> just fine.) I didn't notice any special call on their feedparser.parse() 
> and I can't seem to find anything in the feedparser documentation that 
> addresses this. Has anyone run into this before? Thanks!
It's because &gt; is not the same as >. &gt; is HTML escape sequence for 
 >, which means browser would substitute them to a real > instead of 
considering it as part of html tags.



More information about the Tutor mailing list