Created
July 27, 2011 20:57
-
-
Save gjcourt/1110355 to your computer and use it in GitHub Desktop.
One line query string parser (@dcramer)
This file contains hidden or 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
dict((k, v[0] if len(v) == 1 else v) for k, v in [(k, [z[1] for z in v]) for k, v in itertools.groupby(sorted([x.split('=') for x in qs.split('&')], key=lambda x: x[0]), key=lambda x: x[0])]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment