python at jayloden.com
Thu Aug 2 21:06:52 CEST 2007
Robert Dailey wrote:
> Both strings in your example are exactly the same, unless I'm missing
> On 8/2/07, Roman <rgelfand2 at hotmail.com> wrote:
>> Is there a package that converts a string that contains special
>> characters in xml to to literal value. For instance, converts string
>> http://myhome/¶m to http://myhome/&param.
>> Thanks in advance
Robert, your newsreader/mail program is converting the HTML/XML entity codes into the corresponding character so you're not seeing the plain text version of what the OP posted. He's asking for code to convert XML entities like '&' into their escaped strings.
I believe xml.sax.saxutils.encode() is what the OP is looking for:
>>> import xml.sax.saxutils
More information about the Python-list