简体   繁体   English

如何找到urllib2

[英]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. 我是python的新手(我正在使用python3),并且尝试使用urllib2来学习制作网络爬虫。 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. 我可以导入urllib,但是urllib2与urllib不在同一个目录中,并且在尝试导入urllib2时在终端中收到错误消息。

From my understanding, urllib2 is supposed to be part of pythons standard library. 据我了解,urllib2应该是pythons标准库的一部分。 Where can I find it? 在哪里可以找到它? Is there somewhere I can just download it separately and place it into the same directory as urllib? 有什么地方我可以单独下载它,然后将其放置在与urllib相同的目录中?

Python 3 refactored urllib and urllib2 into a new package called urllib with submodules . Python 3将urlliburllib2重构为一个带有子模块的名为urllib的新程序包。

Use urllib.request and urllib.error instead. 请改用urllib.requesturllib.error

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

For Python 3 use urllib like 对于Python 3,请使用urllib

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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