오류 해결

[오류 해결] SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape

JinWooHong Dev 2021. 8. 8. 23:14

Python에서 파일을 읽어올 때 SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape 다음과 같은 오류가 뜰 경우 파일 경로를 수정해주면 된다.

이런 경우에 'C:\Users\USER\Downloads' 에서

data_path = 'C:\\Users\\USER\\Downloads'으로 수정하면된다.

(또는, f'C:\Users\USER\Downloads')