📅  最后修改于: 2022-03-11 14:55:54.841000             🧑  作者: Mango
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)