gpt4 book ai didi

mechanize - Beautiful Soup 在解析 Mechanize 输出时遇到问题

转载 作者:行者123 更新时间:2023-12-04 16:21:19 26 4
gpt4 key购买 nike

def return_with_soup(url):
#uses mechanize to tell the browser we aren't a bot
#and to retrieve webpage
#returns a soupified webpage
browser = mechanize.Browser() #I am made of human
browser.set_handle_robots(False) #no bots here, no sir
browser.open(url)
#print browser.response().read()
soup = BeautifulSoup(browser.response().read()) #this is where it breaks
return soup

它引用倒数第二行“类型错误:模块不可调用”引发此错误

究竟是怎么回事?

最佳答案

BeautifulSoup 是作为模块导入的。所以我不得不将该行更改为:

BeautifulSoup.BeautifulSoup(...)

关于mechanize - Beautiful Soup 在解析 Mechanize 输出时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39312265/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com