AttributeError: 'module' object has no attribute 'urlopen报错解决办法

AttributeError: ‘module’ object has no attribute 'urlopen
在python3中此处的urllib都应该改成urllib.request

python NameError: name ‘raw_input’ is not defined
在python3中用input替换了raw_input

TypeError: can’t use a string pattern on a bytes-like object
在python3中应在正则表达式前应添加html = html.decode(‘utf-8’)

以上是几个用python初学爬虫时因python3和python2的区别造成的报错。

猜你喜欢

转载自blog.csdn.net/qq_36616602/article/details/83019305