프로그래밍/Python28 [Python] schedule 라이브러리 30분마다 실행 schedule.every(30).minutes.do(실행할 함수) 매주 월요일 9시 10분마다 실행 schedule.every().monday.at("09:10").do(실행할 함수) 매일 10시 30분마다 실행 schedule.every().day.at("10:30").do(실행할 함수) 2022. 11. 29. [Python] 마우스 좌표 출력 / pyautogui 라이브러리 import pyautogui import time while True: print(pyautogui.position()) # 마우스 좌표를 출력 time.sleep(0.1) # 0.1초 딜레이 --> 주로 업무 자동화 프로그램에 사용 pyautogui.position() - 마우스 좌표를 입력받음 pyautogui.moveTo(x, y) - x,y의 좌표로 이동. 절대 좌표 pyautogui.moveTo(x, y, 시간) - x, y의 좌표로 지정된 시간동안 이동. 절대 좌표 pyautogui.moveRel(x, y) - 현재 마우스 위치로부터 x, y 픽셀만큼 이동 pyautogui.click((50, 50)) - 50,50 위치에 마우스를 클릭 pyautogui.c.. 2022. 11. 29. [Python] 문자열 앞 r의 의미 , Raw string python 코드에서 string 앞에 r이 붙어있는 경우가 있다. Raw string - 해당 string literal을 raw string으로 만들어주기 위함 => 모든 Escape문자를 그대로 출력 * Escape 문자란? \ 를 앞에 붙여 원래의 의미를 벗어나는 문자 ex) \n , \r , \t, \$ 등등 2022. 11. 28. [Python] 번역 프로그램 - 구글 번역기 라이브러리 설치 2021.11월 기준 안정적인 라이브러리 버전 pip install googletrans==4.0.0-rc1 import googletrans # googletrans를 불러옴 translator = googletrans.Translator() # dest : 번역 후 언어, src: 번역할 문자의 언어로 auto가 기본으로 되어있음. str1 = "행복하세요" result1 = translator.translate(str1, dest='en', src='auto') print(f"행복하세요 => {result1.text}") str2 = "I am happy" result2 = translator.translate(str2, dest='ko', src='en') prin.. 2022. 11. 28. [Python] 컴퓨터 정보 확인 코드 psutil 라이브러리 - 컴퓨터의 정보를 확인할 때 사용 pip install psutil import psutil # CPU의 속도 출력 cpu = psutil.cpu_freq() print(cpu) # CPU의 물리코어 수 출력 cpu_core = psutil.cpu_count(logical = False) print(cpu_core) # 메모리 정보 출력 memory = psutil.virtual_memory() print(memory) # 디스크 정보 출력 disk = psutil.disk_partitions() print(disk) # 네트워크를 통해 보내고 받은 데이터량 출력 net = psutil.net_io_counters() print(net) [결과] scpufreq(current=2.. 2022. 11. 24. [Python] QR코드 만들기 qrcode 라이브러리 설치 - pip install qrcode import qrcode qr_data = 'www.naver.com' qr_img = qrcode.make(qr_data) // qrcode.make로 이미지를 만들어 qr_img 변수에 바인딩 save_path = qr_data + '.png' qr_img.save(save_path) // 이미지 저장 2022. 11. 24. 이전 1 2 3 4 5 다음