以下は、ウェブサイト上の単語を検索するスクリプトです。この場合、https://finance.yahoo.com/quote/%5EGSPC?p=^GSPCの "S & P"です。検索番号Pythonのウェブサイトの範囲
私の質問は、2300と2400の間の数値範囲を検索するにはどうすればいいですか...... 2400より大きい/より大きい数値を検索するにはどうすればよいですか?基本的には、ポイント。
ご協力いただきありがとうございます。
import webbrowser
import urllib.request
page = urllib.request.urlopen("https://finance.yahoo.com/quote/%5EGSPC?p=^GSPC")
content = page.read().decode('utf-8')
if "S&P" in content :
webbrowser.open("https://finance.yahoo.com/quote/%5EGSPC?p=^GSPC")
updated 2017-5-16 以下の人が私を助けました。ありがとう、感謝したすべての人に感謝します。私は周りをうんざりし、下に行った。
import urllib.request
import webbrowser
from bs4 import BeautifulSoup
page = urllib.request.urlopen("https://finance.yahoo.com/quote/%5EGSPC?p=^GSPC")
content = page.read().decode('utf-8')
soup = BeautifulSoup(content, 'html.parser')
val = soup.find("span", {"data-reactid": "36"}).decode_contents(formatter="html")
if val >= "2,400.00":
webbrowser.open("https://finance.yahoo.com/quote/%5EGSPC?p=^GSPC")