URLs and ampersands

Matthew Woodcraft mattheww at chiark.greenend.org.uk
Tue Aug 5 13:53:08 EDT 2008


Gabriel Genellina wrote:
> Steven D'Aprano wrote:

>> I have searched for, but been unable to find, standard library
>> functions that escapes or unescapes URLs. Are there any such
>> functions?

> Yes: cgi.escape/unescape, and xml.sax.saxutils.escape/unescape.

I don't see a cgi.unescape in the standard library.

I don't think xml.sax.saxutils.unescape will be suitable for Steven's
purpose, because it doesn't process numeric character references (which
are both legal and seen in the wild in /href/ attributes).

-M-



More information about the Python-list mailing list