Possible Duplicate:
Python, opposite function urllib.urlencode
I have a url string which is already formatted with key=value pairs and &’s in between, as created by urllib’s urlencode function. Is there a standard Python library utility to reverse this process? That is:
Given a string representing a url, return a string containing the base url and a dictionary containing the key-value pairs in the url.
I can cook up a simple solution on my own that does this for reasonable urls, but I imagine weird things can happen with an arbitrary url. So is there a standard library function that does this safely?
The built-in
urlparsedoes what you want: