【发布时间】:2018-08-15 07:24:37
【问题描述】:
我正在尝试从网页中获取 VIX 的价值。
我正在使用的代码:
raw_page = requests.get("https://www.nseindia.com/live_market/dynaContent/live_watch/vix_home_page.htm").text
soup = BeautifulSoup(raw_page, "lxml")
vix = soup.find("span",{"id":"vixIdxData"})
print(vix.text)
这给了我:
''
如果我看到 vix,
<span id="vixIdxData" style=" font-size: 1.8em;font-weight: bold;line-height: 20px;">/span>
在网站上元素有文本,
<span id="vixIdxData" style=" font-size: 1.8em;font-weight: bold;line-height: 20px;">15.785/span>
15.785 值是我想通过使用请求获得的值。
【问题讨论】:
标签: python python-3.x python-requests