美文网首页
python爬虫小试

python爬虫小试

作者: 心对 | 来源:发表于2017-06-13 23:13 被阅读10次

    刚开始学习,慢慢积累经验喽!大家共勉

    这个代码是看博客拿到的,连接在此:python简单学习

    在python3.6版本下出现错误,

    1. 出现AttributeError: module 'urllib' has no attribute 'urlopen'错误

    解决方案:真正原因是在Python3.X中应该用urllib.request

    错误1.png

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

    解决方案:这种情况解决方法就是加上html=html.decode('utf-8')#python3这句代码

    具体可以看上面那个图片。

    相关文章

      网友评论

          本文标题:python爬虫小试

          本文链接:https://www.haomeiwen.com/subject/wjbjqxtx.html