-
[Python] 'utf-8' codec can't decode byte 0xbe 에러 해결Memo/Python 2023. 2. 17. 16:47
파이썬에서 한글이 포함된 print문을 실행할 때 아래와 같은 오류가 발생하였다.
SyntaxError: Non-UTF-8 code starting with '\xbd' in file ... 또는 SyntaxError: (unicode error) 'utf-8' codec can't decode byte 0xbe in position 0: invalid start byte
다음과 같이 주석이 소스코드 제일 상단에 작성하면 해결할 수 있다.
# coding=euc-kr
처음에는 utf-8을 입력했는데, 두 번째 에러가 계속 발생하여 검색해 보니다, utf-8이 아닌 euc-kr을 입력해 해결할 수 있었다.
PEP 263 – Defining Python Source Code Encodings | peps.python.org
PEP 263 – Defining Python Source Code Encodings Author: Marc-André Lemburg , Martin von Löwis Status: Final Type: Standards Track Created: 06-Jun-2001 Python-Version: 2.3 Post-History: Table of Contents This PEP proposes to introduce a syntax to declar
peps.python.org
[오류 해결] UnicodeDecodeError : 'utf-8' codec can't decode byte 0xbc in position 0: invalid start byte
안녕하세요~ 꽁냥이에요. Pandas에서 read_table, read_csv, read_excel과 같이 데이터를 읽어오는 함수를 사용할 때 간혹 아래와 같은 오류가 발생합니다. UnicodeDecodeError : 'utf-8' codec can't decode byte 0xbc in posi
zephyrus1111.tistory.com
'Memo > Python' 카테고리의 다른 글
[Selenium] 요소를 찾지 못하는 경우, frame 안의 요소 가져오기 (0) 2024.03.04 [SQLAlchemy] declarative_base() function is now available as sqlalchemy.orm.declarative_base(). 경고 해결 (0) 2024.02.19 [Python] 텔레그램 API로 메시지 전송 방법 (마크다운, 이모지, 버튼) (0) 2023.02.13 [Django] 템플릿(html)에서 파이썬 enumerate 사용 (0) 2023.01.30 [Selenium] 요소 위치로 스크롤 이동하기 (0) 2023.01.25