url.parse Python2.7 等价

url.parse Python2.7 equivalent

什么是 Python2.7 等同于

from urllib.parse import urlparse, parse_qs
parsed_url = urlparse(url)
params = parse_qs(parsed_url.query)

我明白了

>>> from urllib.parse import urlparse
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named parse

谢谢!

python2中使用

from urlparse import urlparse, parse_qs
parsed_url = urlparse(url)
params = parse_qs(parsed_url.query)