본문 바로가기

Python56

[python] pandas 차트 생성 오랜만에 해보니 셀레늄 문법이 일부 바뀜 from selenium import webdriver from selenium.webdriver.chrome.service import Service from webdriver_manager.chrome import ChromeDriverManager #현재 설치된 크롬 사용 from selenium.webdriver.common.by import By import pandas as pd chrome_service = Service(ChromeDriverManager().install()) chrome_options = webdriver.ChromeOptions() chrome_options.add_argument('headless') #브라우저가 백그라운드로 .. 2021. 12. 24.
파이썬 셀레늄 웹드라이버 자동 관리하기 pip install webdriver-manager 매번 버전 올라갈 때마다 교체했었는데.. 대박 명령어다! 아래는 사용 예시 from selenium import webdriver #pip install selenium from webdriver_manager.chrome import ChromeDriverManager #pip install webdriver-manager options = webdriver.ChromeOptions() options.add_argument('headless') driver = webdriver.Chrome(ChromeDriverManager().install(), options=options) driver.get('https://naver.com') # n초 이내에.. 2021. 8. 26.
파이썬 tkinter - 테이블 항목 선택시 값 가져오기 import tkinter as tk # 툴킷 인터페이스 import tkinter.ttk as ttk # tk의 확장 (트리뷰, 콤보박스 등 제공) window = tk.Tk() window.geometry("400x200+50+50") window.title("창 타이틀") frame = tk.Frame(window) frame.pack() tree = ttk.Treeview(frame, columns=(1, 2, 3), height=5, show="headings") tree.pack(side='left') # 필드명 tree.heading(1, text="A") tree.heading(2, text="B") tree.heading(3, text="C") # 기본 너비 tree.column(1, w.. 2020. 10. 30.
단어 클라우드 만들기 - 설치 윈10 에 파이썬 설치 (3.9에서는 오류 발생해서 3.8로 설치) https://www.python.org/ftp/python/3.8.6/python-3.8.6-amd64.exe add python 3.8 to PATH 체크 인스톨 나우 클릭 cmd 창 실행 명령어 실행 pip install bs4 아래 페이지에서 JPype를 cp38-amd64 파일로 다운로드 https://www.lfd.uci.edu/~gohlke/pythonlibs/#jpype cmd 에서 명령어 실행 pip install [다운받은 whl 파일 경로] ex) pip install C:\Users\test\Desktop\JPype1-1.0.2-cp38-cp38-win_amd64.whl 명령어 실행 pip install konlpy.. 2020. 10. 28.
파이썬으로 메일 보내기 (gmail) import smtplib from email.mime.text import MIMEText #보안 수준 낮은 앱 허용 on 필요 #https://myaccount.google.com/lesssecureapps smtp = smtplib.SMTP('smtp.gmail.com', 587) smtp.ehlo() # handshaking smtp.starttls() # TLS smtp.login('from@gmail.com', 'pw') msg = MIMEText('내용') msg['Subject'] = '안녕하세요' msg['To'] = 'to@gmail.com' #생략 가능 smtp.sendmail('from@gmail.com', 'to@naver.com', msg.as_string()) smtp.quit() 2020. 7. 30.
scoop + python 으로 안드로이드 UI 자동화 #설치 했으면 생략 scoop install adb scoop install python #에이전트 다운로드 (생략 가능) https://github.com/openatx/atx-agent/releases 위 링크에서 arm7 용 다운로드 #폰 연결 후 에이전트 설치 및 실행 (생략 가능 - 자동 설치함) adb push atx-agent /data/local/tmp adb shell chmod 755 /data/local/tmp/atx-agent adb shell /data/local/tmp/atx-agent server -d #uiautomator2 설치 pip install -U uiautomator2 #인스펙터 설치 pip install -U weditor #인스펙터 바탕화면에 바로가기 만들어서 .. 2020. 4. 15.
jira-python 예제 코맨트 추가 # https://jira.readthedocs.io/ from jira import JIRA server = "https://" user = "" password = "" server = {'server': server} jira = JIRA(options=server, basic_auth=(user, password)) issue = jira.issue("TEST-5") jira.add_comment ( issue , "Comment text" ) 워크로그 조회 # https://jira.readthedocs.io/ from jira import JIRA server = "https://" user = "" password = "" server = {'server': server} jir.. 2020. 3. 31.
python+selenium+headless chrome+openpyxl 예제 레드마인 결함 개수 추출 후 엑셀 저장하기 from selenium import webdriver from bs4 import BeautifulSoup import re import openpyxl ### 헤드리스 브라우저 셋팅 ### options = webdriver.ChromeOptions() options.add_argument('headless') #options.add_argument('window-size=1920x1080') #options.add_argument("disable-gpu") driver = webdriver.Chrome('F:/~~~/~~~/chromedriver.exe', chrome_options=options) ### 실제 동작 ### #로그인 driver.get('h.. 2019. 2. 7.
[Mac] pipenv 환경에 장고 설치 1. brew 설치 (있으면 스킵)/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 2. brew를 이용하여 파이썬3과 pipenv 설치brew install pythonbrew install pipenv 3. 가상환경으로 사용할 폴더 생성 후 진입mkdir testpcd testp 4. 파이썬3를 위한 가상환경 셋팅pipenv --three 4.1 오류 발생시 조치sudo vi ~/.bash_profile아래 내용 추가export LANG=en_US.UTF-8export LC_ALL=en_US.UTF-8참고 : https://github.com/pypa/pipenv/issues.. 2018. 8. 29.