简体   繁体   English

Python urllib2库

[英]Python urllib2 library

I copied an example whcich use this library but when i get to the line import urllib2 it gives me an error : No module named 'urllib2'. 我复制了一个使用该库的示例,但是当我进入import urllib2行时,它给了我一个错误:没有名为“ urllib2”的模块。 I searched for a download of the library but couldnt found. 我搜索了该库的下载,但找不到。 Anyone can help me? 有人可以帮助我吗? Thank you. 谢谢。

It's most probable that you are using Python 3. 您最有可能使用的是Python 3。

With Python versions > 3, those relevant modules are structured like this : 随着Python版本> 3,这些相关模块的构成就像这样

Current Name      Replacement Name
urllib2           urllib.request, urllib.error
urlparse          urllib.parse
urllib            urllib.parse, urllib.request, urllib.error [6]
robotparser       urllib.robotparser

I guess you are using Python 3. In Python 3, urllib2 is renamed to urllib. 我猜您正在使用Python3。在Python 3中,urllib2重命名为urllib。

More info Python urllib 更多信息Python urllib

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

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