Hodustory/프로그래밍&DB

[python/파이썬] 출력에서 한글 깨짐 문제

호두밥 2019. 12. 19. 11:28

파이썬에 한글을 출력하다보면 가끔 한글이 깨지는 문제가 발생하는데요.

그때는 아래의 4줄을 스크립트에 추가해주면 됩니다.

 

import sys
import io
sys.stdout = io.TextIOWrapper(sys.stdout.detach(), encoding = 'utf-8')
sys.stderr = io.TextIOWrapper(sys.stderr.detach(), encoding = 'utf-8')
반응형