Laszlo Nagy wrote:
>
Hi,
I would like to have a function that can convert '>' into '>',
'&' into '&' etc. I could not find how to do it easily (I have a
code snippet for the opposite).
Thanks,
Laszlo
You can use htmlentitydefs module to help with this.
import htmlentitydefs
chr(htmlentitydefs.name2codepoint['gt'])
and (to go the other way)
htmlentitydefs.codepoint2name[ord('>')]
-Larry