분류 전체보기(38)
-
[파이썬] 파일명 일괄변경 / 여러 파일의 이름을 한번에 변경 - glob
os 모듈과 glob 모듈을 사용해서 폴더 안에 있는 파일명을 일괄로 변경. glob(pathname) 함수는 결괏값으로 파일 경로의 리스트를 반환한다. pathname에 와일드카드 문자(wildcard character)를 사용할 수도 있다. 다음은 파일명 앞에 문자열을 추가하는 예이다. path = "./임시폴더" files = glob.glob(path + '/*') for f in files: new_f = os.path.join(path, 'img_' + os.path.basename(f)) # 문자 추가 os.rename(f, new_f) print('{} ==> {}'.format(f, new_f)) 이 부분이 추가된 파일명이다. new_f = os.path.join(path, 'img_' ..
2020.09.12 -
[파이썬] 웹페이지를 PDF화일로 변환하는 방법 ( web to pdf / HTML to pdf ) - pdfkit
pdfkit 모듈은 wkhtmltopdf 유틸리티를 이용하여 , 웹페이지 또는 저장된 HTML문서를 PDF문서로 변환하는 래퍼 모듈이다. 따라서, wkhtmltopdf가 설치되어 있어야 하고 경로가 configuration에 지정되어야 한다. https://wkhtmltopdf.org/downloads.html wkhtmltopdfAll downloads are currently hosted via GitHub releases, so you can browse for a specific download or use the links below. Do not use wkhtmltopdf with any untrusted HTML – be sure to sanitize any user-supplied HTM..
2020.09.10