Does Python 2.6 have a built-in URL parameter parser?

Given URl, how can I get the parameter dictionary back?

+3
source share
2 answers

http://docs.python.org/library/urlparse.html

edit: it returns a tuple of URL parameters. If you absolutely need this in the dictionary, it looks like you have to implement it yourself. (get a tuple, then assign it a dict)

string = "addressing scheme network location path query fragment_identifier".split()
url = urlparse.urlsplit("url")

dictionary = dict(zip(string,url))

Not sure if this line of the dictionary is valid, but it is something like this.

+7
source

urlparse. urlsplit urlparse namedtuple, -. , , , . , parse_qs parse_qsl

+2

Source: https://habr.com/ru/post/1791134/


All Articles