Don’t parse this manually; Python has the urllib.parse.parse_qs
function that does exactly what you want.
from urllib.parse import parse_qs
parse_qs(line)
In Python 2 this is in the urlparse
module:
from urlparse import parse_qs
1
solved how to transform the string into a dict in python? [duplicate]