learn_python3_spider icon indicating copy to clipboard operation
learn_python3_spider copied to clipboard

没有想到原因,求解

Open fengyan-cn opened this issue 5 years ago • 1 comments

File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37\lib\site-packages\bs4_init_.py", line 287, in init elif len(markup) <= 256 and ( TypeError: object of type 'NoneType' has no len()

fengyan-cn avatar Feb 18 '20 16:02 fengyan-cn

也不放具体代码,神仙能给你定位问题。。。 我自己做的时候出现这个情况是因为爬的网站(豆瓣)做了简单反爬,需要给程序加一个headers 比如: headers={'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36'} response = requests.get(url,headers = headers)

UnlightedOtaku avatar Mar 22 '20 12:03 UnlightedOtaku