我试图解析this site来创建5个列表,每天一个,每个公告填充一个字符串。例如
[in] custom_function(page)
[out] [[<MONDAYS ANNOUNCEMENTS>],
[<TUESDAYS ANNOUNCEMENTS>],
[<WEDNESDAYS ANNOUNCEMENTS>],
[<THURSDAYS ANNOUNCEMENTS>],
[<FRIDAYS ANNOUNCEMENTS>]]
但我想不出正确的方法。你知道吗
这就是我目前所拥有的
from bs4 import BeautifulSoup
import requests
import datetime
url = http://mam.econoday.com/byweek.asp?day=7&month=4&year=2014&cust=mam&lid=0
# Get the text of the webpage
r = requests.get(url)
data = r.text
soup = BeautifulSoup(data)
full_table_1 = soup.find('table', 'eventstable')
我发现我想要的是突出显示的标签,但我不知道如何找到确切的标签,然后将时间/公告解析成一个列表。我试过多种方法,但总是越来越混乱。你知道吗
我该怎么办?你知道吗
其思想是找到所有具有
events
类的td
元素,然后读取其中的div
元素:印刷品:
相关问题 更多 >
编程相关推荐