Traceback (most recent call last)


1.AttributeError: module 'urllib.response' has no attribute 'read'

代码:

res=urllib.response.read().decode('UTF-8')#读取网页内容,用utf-8解码成字节

  1) python3中应该

    import urllib.request

  2)代码改为

res=response.read().decode('UTF-8')#读取网页内容,用utf-8解码成字节

————————————————————————————————————————————————

2.bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml.

代码:

soup=BeautifulSoup(res,'lxml')

代码没问题,需要下lxml

termin输入

pip install lxml

下载lxml

————————————————————————————————

3.NoneType' object has no attribute 'find_next'

待解决


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM