Answers for "data-reactid beautifulsoup"

0

data-reactid beautifulsoup

from bs4 import BeautifulSoup
import requests
import sys
from datetime import datetime, timedelta
import pandas as pd

code = input("Enter the NYSE stock symbol: ")

#Your Choice Stock
source = requests.get('https://finance.yahoo.com/quote/'+ code +'/history p='+ code).text
soup = BeautifulSoup(source, 'lxml')
price = soup.find('span', attrs={"data-reactid": "55"}
print(code + " stock: " + price.text)
Posted by: Guest on November-24-2020

Browse Popular Code Answers by Language