ImportError: cannot import name 'urlopen' from 'urllib'

Python 自然语言处理 P88

from urllib import urlopen

Traceback (most recent call last):

  File "<ipython-input-3-38916afb020b>", line 1, in <module>
    from urllib import urlopen

ImportError: cannot import name 'urlopen' from 'urllib'

Python 2.x 和 Python 3.x 某些库位置不同
修改为:

from urllib.request import urlopen
发布了44 篇原创文章 · 获赞 0 · 访问量 1311

猜你喜欢

转载自blog.csdn.net/qq_41664688/article/details/104269022