【发布时间】:2019-05-01 20:33:22
【问题描述】:
from bs4 import BeautifulSoup as BS
url="https://nseindia.com/live_market/dynaContent/live_watch/get_quote/GetQuote.jsp?symbol=KOTAKBANK&illiquid=0&smeFlag=0&itpFlag=0"
page=urllib.request.Request(url,headers={'User-Agent': 'Mozilla/5.0'})
infile=urllib.request.urlopen(page).read()
data = infile.decode('ISO-8859-1') # Read the content as string decoded with ISO-8859-1
print (soup.find('span', {'id':'vwap'}).text)
我在 jupyter 中运行这段代码;我希望输出在网页上显示为 VWAP 的值,但没有任何内容显示为输出。
【问题讨论】:
标签: python html web-scraping