Created
May 15, 2021 14:45
-
-
Save Park-Developer/2b268974c43b06f4cdecb35312f84c7f to your computer and use it in GitHub Desktop.
BeautifulSoup : find()
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import requests | |
from bs4 import BeautifulSoup | |
url = "https://finance.naver.com/item/main.nhn?code=034220" | |
result = requests.get(url) | |
bs_obj = BeautifulSoup(result.content,"html.parser") | |
no_today = bs_obj.find("p", {"class": "no_today"}) # 태그 p, 속성값 no_today 찾기 | |
blind = no_today.find("span") # 태그 span, 속성값 blind 찾기 | |
now_price = blind.text | |
print(now_price) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment