open
-
[converter] docx 파일을 txt로 바꾸기Python 2021. 1. 14. 18:50
Python 프로그램 docx -> txt 사용하기 전 pip을 이용해서 docx2txt을 설치해줘야함 pip install docx2txt{convert.py} import os import docx2txt def docx_to_txt(path, filename): text = docx2txt.process(path + filename).split('\n') # docx 파일의 내용이 text에 담기는데 '\n' 줄바꿈 문자 기준으로 나뉘어 리스트로 만들어 진다. newfile = os.path.splitext(filename)[0] + '.txt' f = open(path + newfile, 'w') # txt 파일 오픈(없으면 생성됨) for..