Parse query part from url

I want to parse query part from url, this is my code to do this:

>>> from urlparse import urlparse, parse_qs
>>> url = '/?param1&param2=2'
>>> parse_qs(urlparse(url).query)
>>> {'param2': ['23']}

This code looks good, but "parse_qs" method loses query parameters like "param1" or "param1=". Can I parse query part with stantard library and save all parameters?


You want:

from urlparse import parse_qs, urlparse

parse_qs(urlparse(url).query, keep_blank_values=True)
# {'param2': ['2'], 'param1': ['']}

Need Your Help

Expression of type 'System.Int32' cannot be used for return type 'System.Object'

c# .net lambda

I am trying to produce a simple scripting system that will be used to print labels. I have done this in the past with reflection with no problem, but I am now trying to do it with Lambda functions so