Skip to content

Instantly share code, notes, and snippets.

@gjcourt
Created July 27, 2011 20:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save gjcourt/1110355 to your computer and use it in GitHub Desktop.
Save gjcourt/1110355 to your computer and use it in GitHub Desktop.
One line query string parser (@dcramer)
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