오답노트
[python] SyntaxError : (unicode error) 본문
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
python 에서 가끔 파일들을 불러올 때 위와 같은 에러가 뜰 때가 있는데, 이는 파일 경로의 \ 를 유니코드의 문자로 인식해서 제대로 파일이 불러와지지 않기 때문이다.
해당 에러를 피하기 위해선 \ 를 / 로 바꾸거나 \\ 를 써서 파일을 불러오면 된다.
'파이썬' 카테고리의 다른 글
[openCV] cv2.adaptiveThreshold CV_8UC1 error (0) | 2021.11.11 |
---|---|
[openCV] openCV-python cv2.imwrite 저장 안 됨 오류 (0) | 2021.11.10 |
[python] combination, permutation (0) | 2021.05.06 |
[numpy] numpy 함수 정리 (0) | 2021.04.12 |
[python] for 문 - try, except (0) | 2021.01.27 |