대량의 업데이트 파일을 일정한 파일 크기로 배포 일정을 수립하기 위한 코드 작성import pandas as pd # 판다스 importregion = input('지역 입력 : ')file_name = input('파일을 입력하세요 : ')file_path = input('파일 경로 : ') + '\\' + region +'\\'df = pd.read_csv(file_path+file_name, sep='\t')# int(df.shape[0])df['분할'] = 'null' # object형df['분할_int'] = 'null' # int형# Initialize the week counterweek = 1# Initialize the cumulative sumcumulative_sum = 0# Iter..
작성 이유배포 전 압축 파일에 빈폴더가 있는지 확인하는 자동화 Tool 개발 시, zipfile 모듈을 사용했을 때 빈폴더를 파일로 압축해제하는 현상이 발생하여 원인 분석 후 해결 과정을 적재 1. 반디집(Bandizip)과 Python zipfile 모듈의 차이Python zip file1. 사용성 및 기능: Python의 zipfile 모듈은 파이썬 코드 내에서 직접 zip 파일을 생성하고, 읽고, 쓰고, 해제할 수 있는 기능을 제공합니다. 이는 프로그램 내에서 자동화된 작업이나 스크립트 작성을 용이하게 합니다.2. 프로그램 통합: 파이썬 코드 내에서 다른 데이터 처리 작업과 쉽게 통합될 수 있습니다.3. 제어와 유연성: 파일 압축 해제 과정에서 특정 파일을 선택적으로 해제하거나, 압축 해제된 파일을..
Chromdriver를 사용하도록 설정하기 if getattr(sys, 'frozen', False) and hasattr(sys, "_MEIPASS"): driver_path = os.path.join(sys._MEIPASS, "chromedriver.exe") driver = webdriver.Chrome() # print('running in a Pyinstaller bundle') else: driver = webdriver.Chrome() # print('running in a normal Python process') pyinstaller로 실행파일 생성 pyinstaller -w -F "파이썬 소스코드 경로"
폴더명 추출 # 폴더명 추출 for item in os.listdir(file_path+App): sub_folder = os.path.join(file_path+App, item) # 폴더경로 + 폴더명 sub_folder2 = os.path.join(item) # 폴더명만 if os.path.isdir(sub_folder): # print("Application_version = " + sub_folder2) print("Application = " + sub_folder2) 파일 열기 # 파일 열기 with open(file_path+App+App_txt, "r", encoding="utf-8") as file: file_content = file.read() print("Application_ve..
주의사항 : 동일한 인터프리터 내에 pathlib 라이브러리가 있을 시 pyinstaller 실행 불가 가상 환경 생성 conda create -n 가상환경명 python==파이썬버전 가상 환경 활성화 conda activate 가상환경명 Pyinstaller 설치 pip install pyinstaller Pyinstaller를 활용한 exe 설치 파일 만들기 pyinstaller Z:\999_sjbang\운영\versionCheck.py
1. python으로 txt 파일 읽기 import os file_path = r"파일 경로" # 파일 열기 with open(file_path, "r", encoding="utf-8") as file: file_content = file.read() print(file_content) 2. python으로 폴더명 읽기 import os main_folder = r"폴더 경로" for item in os.listdir(main_folder): sub_folder = os.path.join(main_folder, item) # 폴더경로 + 폴더명 sub_folder2 = os.path.join(item) # 폴더명만 if os.path.isdir(sub_folder): # print(sub_folder) ..