2016-09-03 13 views
0
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 

をトラブルの解析出力を有するそれは最後の行に2番目を参照して、このエラーがスローされます「タイプエラー:モジュールは呼び出すことはできません」美しいスープはMechanizeのから

を正確に何が起こっていますか?

答えて

0

BeautifulSoupをモジュールとしてインポートしました。だから私はその行を次のように変更しなければならなかった:

BeautifulSoup.BeautifulSoup(...)