Created
March 31, 2016 12:31
-
-
Save mgeeky/69f00d2a4b4614f7104d931825313317 to your computer and use it in GitHub Desktop.
Convert urlencoded string into dictonary (json)
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
def urlencoded2dict(txt): | |
s = '{' + re.sub("([^=]+)=([^&]*)&?", r'"\1":"\2", ', txt) + '}' | |
return json.loads(s.replace(', }', '}')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment