Using Python's BeautifiulSoup Library To Parse Info In A Span HTML Tag
I am writing a Python web scraper that grabs the price of a certain stock. At the end of my program, there are a few print statements to correctly parse the html data so I can grab
Solution 1:
You can use .find
with .text
function to get your required value.
Ex:
from bs4 import BeautifulSoup
page_soup = BeautifulSoup(html, "lxml")
price = page_soup.find("span",{"id":"quote_val"}).text
print( price )
Output:
0.0008
Post a Comment for "Using Python's BeautifiulSoup Library To Parse Info In A Span HTML Tag"