Python /解析:BeautifulSoup错误"模块obj不可调用",其结果来自Mechanize

gre*_*ker 1 python mechanize beautifulsoup

更新:哇,你们所有人都是对的!
由于我还不明白的原因,我需要:"来自BeautifulSoup导入BeautifulSoup"并添加行:

response = br.submit()
print type(response) #new line
raw = br.response().read()#new line
print type(raw)#new line
print type(br.response().read())#new line
cooked = (br.response().read())#new line
soup = BeautifulSoup(cooked)
Run Code Online (Sandbox Code Playgroud)

/更新

嗯,BeautifulSoup和我没有认识到br.response().read()的结果.我已经进口了BeautifulSoup ......

#snippet:
# Select the first (index zero) form
br.select_form(nr=0)
br.form.set_all_readonly(False)
br['__EVENTTARGET'] = list_of_dates[0]
br['__EVENTARGUMENT'] = 'calMain'
br['__VIEWSTATE'] = viewstate
br['__EVENTVALIDATION'] = eventvalidation

response = br.submit()
print br.response().read() #*#this prints the html I'm expecting*

soup = BeautifulSoup(br.response().read()) #*#but this throws 
#TypeError: 'module' object is not callable.  
#Yet if I call soup = BeautifulSoup("http://page.com"), it's cool.*

selecttable = soup.find('table',{'id':"tblItems"})
#/snippet
Run Code Online (Sandbox Code Playgroud)

... 等等

所以我认为我有一种错误的"对象",但男人,BeautifulSoup想要什么样的"对象",你认为呢?

干杯谢谢!!

Nic*_*ood 7

使用

from BeautifulSoup import BeautifulSoup
Run Code Online (Sandbox Code Playgroud)

代替

import BeautifulSoup
Run Code Online (Sandbox Code Playgroud)

否则我认为你做的是正确的!