Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | |||||
3 | 4 | 5 | 6 | 7 | 8 | 9 |
10 | 11 | 12 | 13 | 14 | 15 | 16 |
17 | 18 | 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | 27 | 28 | 29 | 30 |
31 |
Tags
- YOLO
- 프로그래머스
- pip
- ubuntu
- C#
- Linux
- 오류
- Python
- 핑거스타일
- mysql
- C++
- OpenCV
- Numpy
- pandas
- Visual Studio
- VS Code
- 컨테이너
- Selenium
- JSON
- nvidia-smi
- paramiko
- C
- 기타 연주
- Docker
- 채보
- pytorch
- label
- windows forms
- error
- SSH
Archives
- Today
- Total
기계는 거짓말하지 않는다
Python SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 8-9: truncated \UXXXXXXXX escape 오류 본문
Python
Python SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 8-9: truncated \UXXXXXXXX escape 오류
KillinTime 2023. 4. 29. 15:18보통 파일 경로를 읽을 때 발생할 수 있다.
경로 상에 \ (back slash)로 기입되었을 경우
경로 상에 \ (back slash)를 \\ 두번 적어주거나 / (slash)로 바꿔주면 해결할 수 있다.
또는 raw string을 명시해서 해결할 수 있다.
# 1
path = "F:\\dir\\AA.txt"
# 2
path = "F:\dir\AA.txt"
path = path.replace("\\", "/")
# 3
path = r"F:\dir\AA.txt"
'Python' 카테고리의 다른 글
Python Paramiko module SSH exec_command 블록(wait) (0) | 2023.07.08 |
---|---|
Python Pandas 조건에 맞는 데이터 일정 비율 추출 (0) | 2023.05.06 |
Python String u'\ufeff' (0) | 2023.04.21 |
Python operator itemgetter, attrgetter (0) | 2023.04.15 |
Python 순열 (Permutation) 구현 (0) | 2023.04.15 |
Comments