Skip to content

Instantly share code, notes, and snippets.

@yaph
Created June 23, 2009 22:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yaph/134894 to your computer and use it in GitHub Desktop.
Save yaph/134894 to your computer and use it in GitHub Desktop.
create a query string from a dictionary (pquery) as returned from cgi.parse_qs / urlparse.parse_qs when urllib.urlencode is not appropriate
# create a query string from a dictionary (pquery) as returned from
# cgi.parse_qs / urlparse.parse_qs when urllib.urlencode is not appropriate
query_string = '&'.join(
'='.join([key, pquery[key][0]]) for key in pquery
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment