【发布时间】:2018-04-17 18:12:20
【问题描述】:
我正在尝试编写一些代码,当我运行它时,它会给我 BTC 的价格。虽然我在运行代码后没有收到错误消息,但我没有得到价格,而且我得到了NONE。任何人都可以查看我的代码并找出问题所在吗?下面是代码:
import requests
from bs4 import BeautifulSoup
page = requests.get("https://www.coinbase.com/charts")
soup = BeautifulSoup(page.content, 'html.parser')
seven_day = soup.find(id="seven-day-forecast")
bitcoin = soup.find('pre',{'style':'word-wrap: break-word; white-space: pre-
wrap;'})
print(bitcoin)
非常感谢!
【问题讨论】:
-
可能是因为
document.getElementById("seven-day-forecast") = null
标签: python web-scraping bitcoin coinbase-api