일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
- Uipath 기초
- UiPath
- 네이버 로그인 하기
- 네이버매물크롤링
- Python
- 파이썬 가상환경 설치
- pywinauto
- uipath 입문
- pycdas.exe
- 파이썬 환경설정
- 네이버 로그인 캡챠해결
- 파이썬 네이버 로그인
- selenium
- vscode venv 설치
- 커머스API
- venv 설치
- pywinauto 윈도우
- pycdc.exe
- 왕초보 파이썬 실행
- 파이썬네이버부동산
- pywinauto 윈도우제어
- 네이버커머스API
- Selenium 셀렉터잡기
- 가상환경설치
- 파이썬 가상환경 설치방법
- Element is not clickable at point
- 날짜 정규식
- 네이버부동산크롤링
- Uipath 설치방법
- 네이버 로그인 영수증 해결
- Today
- Total
목록전체 글 (381)
콘솔워크
arr1 = [1, 2, 3] arr2 = [4, 5, 6] arr1.extend(arr2) print(arr1) 만약 새로운 배열을 생성하고 싶다면.... arr1 = [1, 2, 3] arr2 = [4, 5, 6] arr3 = arr1 + arr2 print(arr3) 연산자를 사용해야 한다
import pandas as pd import io import win32clipboard win32clipboard.OpenClipboard() clipboard_data: str = win32clipboard.GetClipboardData() win32clipboard.CloseClipboard() df_clipboard = pd.read_csv(io.StringIO(clipboard_data), delimiter="\t", header=None) clipboard_list = df_clipboard[0].values print(clipboard_list)
import re html_text = "안녕하세요. 파이썬입니다." text = re.sub('
from PyQt5.QtWidgets import QMainWindow, QApplication, QPushButton from PyQt5.QtCore import QObject, pyqtSignal class MyWindow(QMainWindow): def __init__(self): super().__init__() # 버튼 생성 self.button1 = QPushButton("Button 1", self) self.button2 = QPushButton("Button 2", self) # 버튼 위치 조정 self.button1.move(50, 50) self.button2.move(150, 50) # 버튼 클릭 시그널에 함수 연결 self.button1.clicked.connect(self.onB..
from selenium import webdriver from selenium.webdriver.chrome.options import Options options = Options() options.add_argument('--disable-popup-blocking') driver = webdriver.Chrome(options=options) 해당 옵션을 추가함
import openpyxl # 엑셀 파일 열기 workbook = openpyxl.load_workbook("example.xlsx") # 시트 선택 ws = workbook.active # 27열 17행 셀 내용 변경 ws.cell(row=17, column=27).value = "새로운 내용" # 변경된 내용 저장 workbook.save("example.xlsx")
from openpyxl import load_workbook workbook = load_workbook('엑셀파일.xls') sheet = workbook['시트이름1'] # 현재 시트에 존재하는 병합되어있는 모든 셀 # 'AA3:BF3' 다음과 같이 범위를 가지고 있음 merged_cells = sheet.merged_cells print(merged_cells) value = '내용' for merged_cell in merged_cells: # 셀의 내용과 value가 일치한다면 if merged_cell.start_cell.internal_value == value: print(merged_cell.start_cell.internal_value) cell_range = merged_cell.c..
import pandas as pd # 빈 DataFrame 생성 columns = ['col1', 'col2'] df = pd.DataFrame(columns=columns) # 새로운 데이터를 담고 있는 리스트 new_data_list = [ {'col1': 'value1', 'col2': 'value2'}, {'col1': 'value3', 'col2': 'value4'}, # ... ] # 반복문을 이용해 데이터를 추가 for new_data in new_data_list: df = df.append(new_data, ignore_index=True) # DataFrame을 csv 파일로 저장 df.to_csv('file.csv', index=False) 반복문을 돌며 자료를 append 하는 방..
from docx import Document from docx.shared import RGBColor document = Document() # 문자열 생성 text = "이 문장에서는 특정 문자열만 빨간색으로 표시합니다." # 문서에 텍스트 추가 paragraph = document.add_paragraph() # 텍스트를 런 객체로 분리 runs = [] for word in text.split(): run = paragraph.add_run(word + " ") if "특정" in word: font = run.font font.color.rgb = RGBColor(255, 0, 0) # 빨간색으로 설정 runs.append(run) # 워드 파일 저장 document.save('example...
a = [1, 2, 3, 4, 5] b = [3, 4, 5, 6, 7] result = list(set(a) - set(b)) print(result) # [1, 2]
my_str = '첫번째>두번째>세번째' my_str_list = my_str.split('>') last_str = my_str_list[len(my_str_list) -1] print(last_str)
참고자료 https://en.wikipedia.org/wiki/Software_versioning Software versioning - Wikipedia From Wikipedia, the free encyclopedia Giving a unique identifier to each software update Software versioning is the process of assigning either unique version names or unique version numbers to unique states of computer software. Within a given version num en.wikipedia.org Version 일반적으로 배포되는 프로그램에는 각각의 버전이 존재하..
import urllib.request some_string = driver.find_element(By.CSS_SELECTOR, 'selector') some_string = urllib.parse.unquote(some_string) urllib의 기능을 사용하면 온전한 한글형태를 가져올 수 있다.
# 메모장 저장 def sentence_to_txt(self, file_name: str, sentence: str): save_path = os.path.join(self.guiDto.convert_path, f"폴더이름") if os.path.isdir(save_path) == False: os.mkdir(save_path) else: pass sentence_txt = os.path.join(save_path, f"{file_name}.txt") with open(sentence_txt, "w", encoding="utf-8") as f: f.write(sentence) self.log_msg.emit(f"{file_name}.txt 저장 완료")
import pandas as pd data = { 'name': ['Alice', 'Bob', 'Charlie', 'Dave'], 'age': [25, 30, 35, 40], 'gender': ['F', 'M', 'M', 'M'] } df = pd.DataFrame(data) print(df) new_df = df[['name', 'age']] print(new_df) 그냥 별거없음... 열 이름만 지정해주면 됨...
# 공통 로딩화면 def wait_loading(self): driver = self.driver # $x('//div[contains(@class, "blockUI")]') loading = True wait_count = 1 self.maximum_wait = 60 self.default_wait = 10 driver.implicitly_wait(1) try: loading_screen = driver.find_element(By.XPATH, '//div[contains(@class, "blockUI")]') except Exception as e: print(f"loading finished") driver.implicitly_wait(1) while loading: try: print(f"wait..
QPlainTextEdit 순수하게 시스템 문자열만 입력 가능한 텍스트 에디터 QTextEdit html, markdown, plaintext 등 여러가지 형태의 문자를 지원하는 텍스트 에디터 메소드는 서로 공유하는게 많으니 용도에 맞게 사용하면 될 것 같다.
def df_to_clipboard(self, df_order: pd.DataFrame): print(df_order) df_order.to_clipboard(excel=True, index=False, header=None) 간단하게 함수로 만들어놨습니다. 해당 엑셀에 있는 정보를 df화 해서 위 함수를 실행하면... 8806442062918 10 8806442063014 20 8806442063229 56 8806439009124 100 8806439004730 120 8806442062819 10 8806442066015 100 8806442065810 100 8806442065919 200 위와 같은 결과가 클립보드에 복사됩니다.
from selenium.webdriver.support.ui import Select select = Select(driver.find_element_by_id("select_id")) # Select 객체 생성 for option in select.options: if "특정문자열" in option.text: select.select_by_visible_text(option.text) # 해당 옵션을 선택합니다. Select는 유용한 기능이긴 하지만 반드시 텍스트 혹은 value와 일치해야 하는 단점이 존재한다. 그 부분을 해결하기 위해서 짜본 코드
my_list = ['', 'apple', '', 'banana', 'carrot', ''] # 빈 값이 있는지 확인 if '' in my_list: # 빈 값들을 제거 my_list = list(filter(lambda x: x != '', my_list)) print(my_list) # ['apple', 'banana', 'carrot']
import re text = "Hello [world], [123] Python [is] awesome." new_text = re.sub(r'\[.*?\]', '', text) print(new_text) # 출력: Hello Python awesome.
# 메모장 저장 def sentence_to_txt(self, file_name: str, sentence: str): save_path = os.path.join("경로를 입력해주세요", "폴더 이름") # 폴더가 없을 시 생성 if os.path.isdir(save_path) == False: os.mkdir(save_path) else: pass # 위에서 선언한 경로에 메모장 파일을 생성함 sentence_txt = os.path.join(save_path, f"{file_name}.txt") with open(sentence_txt, "w", encoding="UTF8") as f: f.write(sentence)
import random content = "폐어망·폐생수통이 '갤럭시 S23'으로 화려하게 변신" synonym_db = ["수려하게", "유려하게", "아름답게", "화려하게"] def synonym_random_select(synonym_db: list, word: str): filtered_list = [synonym for synonym in synonym_db if synonym != word] synonym = random.choice(filtered_list) return synonym def convert_content(content: str, synonym_db: list): for word in synonym_db: if word in content: print(f"'{word}'가 ..
pyinstaller -n "파일명" -w --onefile --clean "main.py" --add-data "venv/Lib/site-packages/newspaper;newspaper" newspaper3k 라이브러리는 html에서 기사나 필요한 본문만 추출해주는 라이브러리이다. 보통은 pyinsatller가 사용자의 기본 폴더 (Local\Temp\_MEIxxxxx) 폴더 내에 필요한 라이브러리들을 넣어주는데, 간혹가다가 못넣어주는 경우가 있다. pyinstaller로 빌드 시 경로를 못잡는 경우가 있는데, 이럴 때는 해당 라이브러리를 아예 pyinstaller에 명시적으로 넣어주면 된다. pyinstaller -n "파일명" -w --onefile --clean "main.py" --add-d..
pip install python-docx from docx import Document # 새로운 Document 객체 생성 doc = Document() # 저장할 문자열 my_text = "Hello, world!" # 문자열을 문서에 추가 doc.add_paragraph(my_text) # 문서 저장 doc.save('my_document.docx')
import pandas as pd df_table = pd.read_html( driver.find_element(By.XPATH, '//table[.//tbody[@id="dataBody"]]').get_attribute("outerHTML") )[0] print(df_table) df_table.to_excel(f"C:\excels\test_excel.xlsx", index=False) print("엑셀 저장됨") pandas의 read_html을 이용한다.
my_str = '10' print(my_str.isdigit()) my_str = '10ㅁㄴㅇㄹ' print(my_str.isdigit()) True False 형태로 출력된다.
구글 드라이브 API 사용 시 pyinstaller 빌드 후에 안될 때가 있다. build 부분에서 static_discovery=False 추가해주면 된다. build(API_NAME, API_VERSION, credentials=cred, static_discovery=False)
[준비물] 일단 ADB설정부터 마치고 와야함 https://uipath.tistory.com/279 [adb] android의 크롬을 개발자 도구(F12)로 확인해보기 아래의 글을 참고하여 adb device 설정까지 마쳐야 함 https://uipath.tistory.com/230 [adb] python 안드로이드 스마트폰 제어하기 1. 스마트폰과 연결하기 위해 구글 개발자 페이지에서 adb (android device bridge)를 uipath.tistory.com appium 클라이언트도 깔아야 함 https://appium.io/ Appium: Mobile App Automation Made Awesome. Appium Philosophy Appium is built on the idea tha..