본문 바로가기

Python_Intermediate

(155)
Python - 5 x 5 사각형 * 출력 알고리즘 Q>5 x 5 사각형 * 출력 알고리즘 A>for i in range(5): for j in range(5): print('*', end='') print() O>************************* Process finished with exit code 0
Python - 기본 * 출력 알고리즘 Q> 기본 * 출력 알고리즘 A>for i in range(5): for j in range(5): if j == i: print('*', end = '') print() O>***** Process finished with exit code 0
Python - webdriver headless Mode(창 숨김 모드) 1. 크롤링 자동화 하다 의문 사항 - 크롬 드라이버를 로드 해서 크롬을 새로 하나 여는거 말고 창을 숨김으로 백그라운도로 로드하고 열수 있지 않을까? 2. 코드 작성 - 기존 기본 webdriver 코드from selenium import webdriver driver = webdriver.Chrome('C:/chromedriver/chromedriver') driver.implicitly_wait(3) driver.get('사이트 주소') - 수정 headless Mode 코드from selenium import webdriver # 크롬 headless 모드 실행 chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('head..
Python - NaverMail 제목 리스트 가져오기 from selenium import webdriver driver = webdriver.Chrome('C:/chromedriver/chromedriver') driver.implicitly_wait(3) driver.get('https://nid.naver.com/nidlogin.login?mode=number') # 일회용 로그인 페이지 # label for 문법 참고 : https://www.codingfactory.net/11008 elem_login = driver.find_element_by_id("disposable_num") elem_login.clear() # 해당 기능을 자주 접근하면 IP를 차단 당할 수 있음 elem_login.send_keys('번호') # 네이버 ..
Python - DaumMail 제목 리스트 가져오기 from selenium import webdriver driver = webdriver.Chrome('C:/chromedriver/chromedriver') driver.implicitly_wait(3) # daum.net - 로그인 driver.get('https://mail.daum.net/') driver.find_element_by_xpath('//*[@id="daumHead"]/div/div/a[4]/span').click() driver.find_element_by_name('id').send_keys('ID') driver.find_element_by_name('pw').send_keys('PW') driver.find_element_by_xpath('//*[@id="log..
Python - DaumMail Auto Login(다음 메일 자동 로그인) from selenium import webdriver from selenium.webdriver.common.keys import Keys driver = webdriver.Chrome('C:/chromedriver/chromedriver') driver.implicitly_wait(3) # daum.net 자동 로그인 driver.get('https://logins.daum.net/accounts/loginform.do?url=https%3A%2F%2Fmail.daum.net%2F') driver.find_element_by_name('id').send_keys('DaumID') # 다음 아이디 입력 driver.find_element_by_name('pw').send_keys..
Python Game - 폭탄 돌려 최종 승자 구하기 # findbomb()은 플레이어목록에서 탈락자의 index를 반환하는 함수 def findbomb(players, start, step): index = (start + step) % len(players) return index # players = input("플레이어들을 빙둘러선 순서로 입력: ").split() players = ['B', 'K', 'M', 'A', 'C', 'D', 'P'] print("플레이어들의 목록: {}".format(players)) start = int(input("시작 위치를 0 이상의 숫자로 입력하세요: ")) step = int(input("간격을 몇 사람으로 할까요: ")) while len(players) > 1: index = findbomb(players..
Magic Commands Line magics%aliasDefine an alias for a system command.‘%alias alias_name cmd’ defines ‘alias_name’ as an alias for ‘cmd’Then, typing ‘alias_name params’ will execute the system command ‘cmd params’ (from your underlying operating system).Aliases have lower precedence than magic functions and Python normal variables, so if ‘foo’ is both a Python variable and an alias, the alias can not be execute..