Search code examples
pythonpython-3.xurllib2urllib

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?


Solution

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

    Use urllib.request and urllib.error instead.