【发布时间】:2017-06-20 07:56:24
【问题描述】:
我刚开始使用 Python。试图从...刮桌子 http://www.dramexchange.com/
但还没有成功。
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)
有什么帮助吗?
【问题讨论】:
-
您遇到了什么问题?
标签: python web-scraping html-table beautifulsoup