我試圖構建一個爬蟲,我想打印 我使用Python 3.5Python的類型錯誤回溯(最近通話最後一個)
在該網頁上的所有鏈接有我的代碼
import requests
from bs4 import BeautifulSoup
def crawler(link):
source_code = requests.get(link)
source_code_string = str(source_code)
source_code_soup = BeautifulSoup(source_code_string,'lxml')
for item in source_code_soup.findAll("a"):
title = item.string
print(title)
crawler("https://www.youtube.com/watch?v=pLHejmLB16o")
但我得到這樣
TypeError Traceback (most recent call last)
<ipython-input-13-9aa10c5a03ef> in <module>()
----> 1 crawler('http://archive.is/DPG9M')
TypeError: 'module' object is not callable
收到這個錯誤你嘗試過重命名你的'crawler'方法? –
是的,我把「crawler」改成了「cat」,但是還是一樣的錯誤 – Travis