반응형
# 메모장 저장
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 저장 완료")
반응형
'프로그래밍 > python' 카테고리의 다른 글
문자열을 특정 문자 기준으로 split하고 그 마지막이 되는 문자를 가져오기 (0) | 2023.03.30 |
---|---|
selenium으로 읽어온 한글의 형태가 이상한 경우 (0) | 2023.03.28 |
데이터프레임에서 특정 열만 추출해서 새로운 데이터프레임으로 만들기 (0) | 2023.03.24 |
selenium 자동화 진행 중 특정 로딩화면이 사라질 때 까지 대기하는 함수 (0) | 2023.03.23 |
[Pyqt5] QPlainTextEdit, QTextEdit (0) | 2023.03.22 |