목록Coding (143)
0w0
문제 두 정수 A와 B를 입력받은 다음, A×B를 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 A와 B가 주어진다. (0 < A, B < 10) 출력 첫째 줄에 A×B를 출력한다. 12345678#coding=utf-8 A,B=input().split()A=int(A)B=int(B) print(A*B)cs
문제 두 정수 A와 B를 입력받은 다음, A-B를 출력하는 프로그램을 작성하시오. 입력 첫째 줄에 A와 B가 주어진다. (0 < A, B < 10) 출력 첫째 줄에 A-B를 출력한다. 12345678910#coding=utf-8 import sys input=sys.stdin.readline a,b=map(int,input().split()) print(a-b) cs
-참조 https://selenium-python.readthedocs.io/index.html Selenium with Python — Selenium Python Bindings 2 documentation Note This is not an official documentation. If you would like to contribute to this documentation, you can fork this project in Github and send pull requests. You can also send your feedback to my email: baiju.m.mail AT gmail DOT com. So far 40+ community selenium-python.readthed..
Webdrive 호출 방식 - CLI, background from selenium import webdriver from selenium.webdriver.chrome.options import Options chrome_options=Options() chrome_options.add_argument("--headless") #CLI bs_driver=webdriver.Chrome(chrome_options=chrome_options, executable_path='C:\chromedriver') - GUI, foreground from selenium import webdriver bs_driver=webdriver.Chrome("C:\chromedriver")
#제목 subject 작성 bs_driver.find_element_by_class_name('textarea_tit').send_keys('글적글적') ###iframe!!! #첫번째 iframe 정보를 가져옴.(내용 작성부분 POST는 첫번째 iframe 이기 때문임) iframe=bs_driver.find_elements_by_css_selector('iframe')[0] #iframe 구성으로 전환 bs_driver.switch_to_frame(iframe) #내용 POST 작성 bs_driver.find_element_by_id('tinymce').send_keys('test input') bs_driver.find_element_by_xpath("""//*[@id="tinymce"]""").s..
#coding=utf-8 import sys import io import time from selenium import webdriver class tistory_connection: #초기화, webdriver 설정 def __init__(self): self.bs_driver=webdriver.Chrome('C:\Workspace\webdriver\chrome\chromedriver') #self.bs_driver.set_window_size(x, y) #티스토리 로그인과 게시글작성 def loginNwrite(self): self.bs_driver.get('https://www.tistory.com/auth/login/?redirectUrl=https%3A%2F%2F3210w0.tistory.co..
CLI로 백그라운드 동작이기 때문에 implicitly_wait(), time.sleep()은 굳이 안줘도됨. GUI도 굳이 대기 시간을 주지 않아도 퍼포먼스가 좋음. CLI 테스트 부분은 추가 모듈과 추가 호출을 통해 --headless 옵션을 사용함 (걍 phantomjs를 사용해됨) from selenium.webdriver.chrome.options import Options chrome_options=Options() chrome_options.add_argument("--headless") #CLI bs_driver=webdriver.Chrome(chrome_options=chrome_options, executable_path='C:\chromedriver') 1 2 3 4 5 6 7 8 9..
12345678910111213141516171819202122232425262728293031323334353637383940414243#coding=utf-8#IMPORT Areaimport sysimport ioimport timeimport requestsfrom bs4 import BeautifulSoupfrom selenium import webdriver #CODE Areaprint(sys.version) # browser 엔진에서 파싱되는 시간을 대기(중간 파싱완료되면 대기종료)#bs_driver.implicitly_wait(2) # process 에서 시간을 대기#time.sleep(1) #implicitly_wait()와 time.sleep()의 차이점#1. 대기 대상이 browser ..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 import datetime now=datetime.datetime.now() print(now) #년 월 일 print(now.year) # print("%04d"%now.year) print("%02d"%now.month) # print(now.month) print("%02d"%now.day) # print(now.day) #시 분 초 print(now.hour) print(now.minute) print(now.second) print("\n==윗쪽은 datetime 모듈 사용, 아래쪽은 time 모듈 사용==\n") im..
- 파이썬 로그인, 세션 생성 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 #coing=utf-8 import sys print(sys.version) from bs4 import BeautifulSoup import requests #로그인 정보 LOGIN_INFO={ # 'email': "IDID", # 'password': "PWPW" # 'user_id': 'IDID', # 'user_pw': 'PWPW', # 'user-submit': rep.quote_plus('로그인'), # 'user-cookie': ..