0
我一直在爲這個網站開發一個網絡爬蟲(http://www.bobaedream.co.kr/cyber/CyberCar.php?gubun=I&page=1)。但是我在抓取每個股票頭銜時遇到了麻煩。我很確定carinfo_title = carinfo.find_all('a',class _ ='title')。網絡爬蟲不斷說沒有屬性,即使它真的有
請查看附件中的代碼和網站代碼,然後給我任何建議。
謝謝。
(網站代碼)
https://drive.google.com/open?id=0BxKswko3bYpuRV9seTZZT3REak0
(我的代碼)
from bs4 import BeautifulSoup
import urllib.request
target_url = "http://www.bobaedream.co.kr/cyber/CyberCar.php?gubun=I&page=1"
def fetch_post_list():
URL = target_url
res = urllib.request.urlopen(URL)
html = res.read()
soup = BeautifulSoup(html, 'html.parser')
table = soup.find('table', class_='cyber')
#Car Info and Link
carinfo = table.find_all('td', class_='carinfo')
carinfo_title = carinfo.find_all('a', class_='title')
print (carinfo_title)
return carinfo_title
fetch_post_list()
謝謝,我想通了!我感謝您的幫助。 –