Open eunja511005 opened 7 months ago
from bs4 import BeautifulSoup import pyautogui import requests codes = [ '133690', '068270' ] for code in codes: url = f'https://finance.naver.com/item/sise.naver?code={code}' response = requests.get(url) html = response.text soup = BeautifulSoup(html, 'html.parser') price = soup.select_one('#_nowVal').text price = price.replace(',', '').strip() print(price)