UnicodeDecodeError: 'cp949' codec can't decode byte 0xff in position 0: illegal multibyte sequence에러가 났을 때
file = open("file.txt",encoding="UTF8")
파일을 열때 encoding을 utf8로 바꾸어서 실행하면 해결될 수 있다.
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 0: invalid start byte
에러가 났을 때
file = open("file.txt",encoding="UTF8",errors="ignore")
utf-8 인코딩이 안될 때 errors="ignore"을 함으로써 에러를 무시하고 파일을 열 수 있다.
하지만 이렇게 열면 파일의 내용이 깨질 위험이 있다.
텍스트 파일의 인코딩 변경
https://tetris.tistory.com/395
Bolt Text Manager - UTF8 인코딩 일괄 변경
2020.06.02 추가Windows 10 x64 에서 크래시 나는 문제를 수정했습니다.개발 및 빌드 버전을 Visaul Studio 2013 에서 Visual Studio 2017 로 업그레이드 했습니다.실행이 안될 경우 VC++ 2017 재배포 가능 패키지 (Mic
tetris.tistory.com
그럴 때는 위와 같은 프로그램들을 사용해
파일을 파이썬으로 열기 전에 파일을 utf8로 인코딩을 함으로써 문제를 해결 할 수 있다.
댓글