问题
What is the Python2.7 equivalent to
from urllib.parse import urlparse, parse_qs
parsed_url = urlparse(url)
params = parse_qs(parsed_url.query)
I get
>>> from urllib.parse import urlparse
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named parse
Thanks!
回答1:
In python2 use
from urlparse import urlparse, parse_qs
parsed_url = urlparse(url)
params = parse_qs(parsed_url.query)
来源:https://stackoverflow.com/questions/50638366/url-parse-python2-7-equivalent