-1
我剛剛開始使用Python。試圖從...刮表 http://www.dramexchange.com/如何在Python中刪除表格
但還沒有成功呢。
import requests, bs4
r = requests.get('http://www.dramexchange.com/')
soup = bs4.BeautifulSoup(r.text, 'lxml')
for table in contents.find_all(class_='tb_NationalDramSpotPrice'):
title = table.find(class_='title').text
for tr in table.find_all('tr'):
_, Item, Daily High, Daily Low. Session High. Session Low. Session Average, Session Change = [td for td in tr.stripped_strings]
print(Item, Daily High, Daily Low. Session High. Session Low. Session Average, Session Change)
任何幫助?
你有什麼問題? –