Created
February 19, 2014 06:48
-
-
Save AlloVince/9087216 to your computer and use it in GitHub Desktop.
Python蛋疼的Url Parser
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
url = urlparse.urlparse(url)._asdict() | |
query = urlparse.parse_qs(url['query']) | |
query['id'] = 1 | |
url['query'] = urllib.urlencode(query) | |
url = urlparse.urlunparse(url.values()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment