Hat Hat - 28 days ago 8
Python Question

how to find urllib2

I am new to python (I'm using python3) and I am trying to use urllib2 to learn to make web crawler. I can't seem to find it anywhere. I can import urllib, but urllib2 is not in the same directory as urllib and I receive an error in terminal when I try to import urllib2.

From my understanding, urllib2 is supposed to be part of pythons standard library. Where can I find it? Is there somewhere I can just download it separately and place it into the same directory as urllib?

Answer

Python 3 refactored urllib and urllib2 into a new package called urllib with submodules.

Use urllib.request and urllib.error instead.

Comments