How to stop Python parse_qs from parsing single values into lists?

A sidenote for someone just wanting a simple dictionary and never needing multiple values with the same key, try:

dict(urlparse.parse_qsl('foo=bar&baz=qux'))

This will give you a nice {'foo': 'bar', 'baz': 'qux'}. Please note that if there are multiple values for the same key, you’ll only get the last one.

Leave a Comment