我正在尝试获取代码为“SEVNYXX”的列下的数据,其中“XX”是使用Python的站点http://www.federalreserve.gov/econresdata/researchdata/feds200628_1.html上紧随其后的数字(例如01、02等)。我目前正在使用站点http://docs.python-guide.org/en/latest/scenarios/scrape/规定的以下方法。但是,我不知道如何确定这个页面的div
,因此无法继续,希望能得到一些帮助。你知道吗
到目前为止,我的情况是:
from lxml import html
import requests
page = requests.get('http://www.federalreserve.gov/econresdata/researchdata/feds200628_1.html')
tree = html.fromstring(page.text)
谢谢
你试过用BeautifulSoup吗?我是个超级粉丝。使用它,你可以很容易地遍历所有你想要的信息,按标签搜索。你知道吗
我把它放在一起,打印出你看到的每一列的值。不知道你想用这些数据做什么,但希望能有所帮助。你知道吗
应您的第二个请求:
这将返回一个字典,其中每个键都是一列的标题,每个值都是另一个字典,其中1)该列位于站点中,2)在列表列表中包含所需的实际数据。你知道吗
例如:
你可以摆弄这个来获得你想要的信息,但是希望这是有用的。你知道吗
相关问题 更多 >
编程相关推荐