简体   繁体   中英

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?

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

Use urllib.request and urllib.error instead.

urllib2现在称为urllib,您可以在此处看到它http://www.python.org/dev/peps/pep-3108/#urllib-package

For Python 3 use urllib like

urllib.request
urllib.error
urllib.parse
urllib.robotparser

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM