我正在使用机械浏览器的.get_data()方法,似乎它会打印出我想要的html内容。我还检查了它打印出的类型,类型为'str'。
但是当我尝试使用BeautifulSoup解析这个字符串时,就会出现以下错误:
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-163-11c061bf6c04> in <module>()
7 html = get_html(first[i],last[i])
8 print type(html)
----> 9 print parse_page(html)
10 # l_to_store.append(parse_page(html))
11 # hfb_data['l_to_store']=l_to_store
<ipython-input-161-bedc1ba19b10> in parse_hfb_page(html)
3 parse html to extract info in connection with a particular person
4 '''
----> 5 soup = BeautifulSoup(html)
6 for el in soup.find_all('li'):
7 if el.find('span').contents[0]=='Item:':
TypeError: 'module' object is not callable
'模块'到底是什么,如何将get_data()返回的内容嵌入HTML中?
BeautifulSoup.BeautifulSoup(html)
- yonili