URLs and ampersands
Steven D'Aprano
steve at REMOVE-THIS-cybersource.com.au
Mon Aug 4 19:43:45 EDT 2008
I'm using urllib.urlretrieve() to download HTML pages, and I've hit a
snag with URLs containing ampersands:
http://www.example.com/parrot.php?x=1&y=2
Somewhere in the process, urls like the above are escaped to:
http://www.example.com/parrot.php?x=1&y=2
which naturally fails to exist.
I could just do a string replace, but is there a "right" way to escape
and unescape URLs? I've looked through the standard lib, but I can't find
anything helpful.
--
Steven
More information about the Python-list
mailing list