在python中导入urllib2

时间:2011-12-08 21:59:41

标签: urllib2 importerror

出于某种原因,在python中导入urllib2会给我一个importerror。我可以成功导入urllib ......发生了什么事?

>>> import urllib
>>> import urllib2
Traceback (most recent call last):
  File "<pyshell#1>", line 1, in <module>
    import urllib2
ImportError: No module named urllib2

1 个答案:

答案 0 :(得分:1)

你正在使用什么版本的python?在python 3中,名称已更改(来自手册):

  

注意urllib2模块已拆分为多个模块   Python 3.0名为urllib.request和urllib.error。