运行出现了: File "E:/owncloud/python_test/img_get.py", line 15, in getbaiduimg data = BeautifulSoup(html,lxml) File "C:\Users\16649\Anaconda3\lib\site-packages\bs4_init_.py", line 149, in init if features is None or len(features) == 0: TypeError: object of type 'module' has no len()
源码: import lxml import requests from bs4 import BeautifulSoup
def getbaiduimg(URL): HEADERS = { "User-Agent":"Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36", "DNT":"1" } html = requests.get(URL,headers=HEADERS) print(html.text) shtml = html.text data = BeautifulSoup(shtml,lxml)
#tiebaurl = input('please input your baidu tieba url : ')
getbaiduimg('https://www.v2ex.com/')
怎么会出现这种情况呢,本人小白。。求大神帮忙解决下
这是一个专为移动设备优化的页面(即为了让你能够在 Google 搜索结果里秒开这个页面),如果你希望参与 V2EX 社区的讨论,你可以继续到 V2EX 上打开本讨论主题的完整版本。
V2EX 是创意工作者们的社区,是一个分享自己正在做的有趣事物、交流想法,可以遇见新朋友甚至新机会的地方。
V2EX is a community of developers, designers and creative people.