기타파일3 For 루프내에서 초기값 설정 차이 item_list = ["Three", "One", "Two", "Three", "Four"]for item in item_list: if "Three" in item: int_rating = 3 print(int_rating)# 3# 3# 3# 3# 3위 코드에서 int_rating은 조건이 맞을 때만 설정되지만, if 조건이 거짓인 경우에도 이전에 설정된 값(3)이 계속 출력, 왜냐하면 조건이 거짓일 때는 int_rating이 업데이트되지 않기 때문.item_list = ["Three", "One", "Two", "Three", "Four"]for item in item_list: int_rating = None # 루프 내에서 초기화 if "Three" in it.. 기타파일 2025. 1. 25. 크롤링파일 ver10 기타파일 2024. 6. 19. pymysql_ from selenium import webdriverfrom selenium.webdriver.chrome.service import Service as ChromeServicefrom webdriver_manager.chrome import ChromeDriverManagerfrom selenium.webdriver.common.by import Byfrom selenium.common.exceptions import NoSuchElementExceptionfrom selenium.webdriver.support import expected_conditions as ECfrom bs4 import BeautifulSoup as bsimport pandas as pdimport timefrom rand.. 기타파일 2024. 6. 13. 이전 1 다음