5

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!

3
  • 3
    You literally have not searched for "urlparse python2". Why? Commented Jun 1, 2018 at 7:41
  • @Tomalak Googled but didn't find parse_qs equivalent Commented Jun 1, 2018 at 7:53
  • 1
    When you Google "urlparse python2" it's the first hit. You may type use CTRL+F to find "parse_qs" on the documentation page. It's not that they have hidden that anywhere. Commented Jun 1, 2018 at 7:56

1 Answer 1

12

In python2 use

from urlparse import urlparse, parse_qs
parsed_url = urlparse(url)
params = parse_qs(parsed_url.query)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.