본문 바로가기

Web_Application/python

(19)
대상 폴더안의 파일에서 문자열 검색 # -*- coding: utf-8 -*- # 여러종류의 파일 encoding 이 존재하는 폴더를 검색 할때는 encoding별로 검색해야 제대로 검색된다. import pandas as pd import os import hanja from hanja import hangul from datetime import datetime file_encodings = ["cp949","utf8"] datetime = datetime.now().strftime("%Y%m%d%H%M00") target_texts = [] #검색할 문자열이나 배열 except_files = [] #제외할 파일명 def search_text(file_path,encoding_word): # print(file_path,file=sav..
분기복리 + 추가불입 import locale locale.setlocale( locale.LC_ALL, '' ) base = 36000000#기본 금액 rate = 0.024#금리 tax = 0.846#세금 monthly_add = 300000#월불입금 yearly_Add = 600000#년불입금 year = 15#기간(년) max_loop = year * 4 #분기 for month in range(0, max_loop): current_benefit = (base + monthly_add) * rate * tax base = (base + monthly_add) * (1 + rate * tax) if month % 4 == 0: base = base + yearly_Add print("") amt = locale.cur..
python - DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated, and in 3.8 it will stop working import pymssql import sys # 추가 if sys.version_info >= (3, 3): import collections.abc as collections_abc else: import collections as collections_abc
python - 예외가 발생했습니다. AttributeErrormodule 'cv2.cv2' has no attribute 'xfeatures2d' opencv 컴파일 중 발생하는 예외입니다. opencv-contrib-python 라이브러리가 필요하니 설치해주세요. pip install opencv-contrib-python
python 텍스트 한문을 한글로 변환하기 https://github.com/suminb/hanja python 3.x에서 설치하기 1. Download Zip 다운로드 후 압축 풀기 2. 관리자 권한으로 명령프롬프트 실행 3. setup.py 가 있는 폴더로 이동 - cd C:\source\test\pylib\hanja-develop\hanja-develop pip install . 실행 의존성 오류가 발생하면 패키지 설치하기 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 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 ..
visual studio code configured debug type 'python' is not supported 현상 1. 잘 쓰던 python debuger 가 갑자기 에러를 띄운다. 2. Python Extention 이 설치되어 있는데 위와 같은 메세지가 보인다. 3. lauch.json 에서 type : python 이 지원하지 않는다고 표시된다. 방법 1. Extention Tab 에 가서 python 이라고 검색하고 2. Python - ms-python.python 을 제거하고 다시 인스톨한다.
python md5 사용법 import hashlib for index in range(100): # hash = hashlib.md5(index).hexdigest() # hash = hashlib.md5("{0}".format(index)).hexdigest() hash = hashlib.md5(("{0}".format(index)).encode("utf-8")).hexdigest() print("{0} = {1}".format(index, hash)) pyfiddle link : https://pyfiddle.io/fiddle/ee1edabd-f51b-44b0-a7ff-7b833d467b4f/?m=Saved%20fiddle
simple string format print('%s %s %s' % ('a','b','c')) # a,b,c print('%s %d %s' % ('a',1,'c')) # a 1 c print('%s %f %s' % ('a',1.111,'c')) # a 1.111000 c print('{0} {1} {2}'.format('a','b','c')) # a b c print('{0} {1} {2}'.format('a',1,'c')) # a 1 c print('{0} {1} {2}'.format('a',1.111,'c')) # a 1.111 c pyfiddle : https://pyfiddle.io/fiddle/59d69f15-7723-4e55-8244-c4a8078dd322/?i=true more format : https://pyformat...