Chapter 3:处理原始文本—3.1 from urllib import urlopen 出现 cannot import name 'urlopen'及其他一些Python3新特性造成的改变

alt+p Python上一条指令

from urllib.request import urlopen
因为python3的库位置跟python2的有点不同

提示无punkt包

到相应文件夹将包解压缩即可

TypeError: cannot use a string pattern on a bytes-like object

增加:raw = raw.decode('utf-8')

原因:Python新特性 应该是需要重新编码

猜你喜欢

转载自blog.csdn.net/DrChenQ/article/details/81257766
今日推荐