Город МОСКОВСКИЙ
00:02:34

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3 (Sovled)

Аватар
Питоновый стиль
Просмотры:
41
Дата загрузки:
02.12.2023 04:47
Длительность:
00:02:34
Категория:
Обучение

Описание

SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape (solved)

This error occurs because you are using a normal string as a path. You can use one of the three following solutions to fix your problem:

1: Just put r before your normal string it converts normal string to raw string:

os.path.join(r"C:\Users\Lenovo\Videos","to","a.mp4")

To know more you can see this: https://stackoverflow.com/questions/37400974/unicode-error-unicodeescape-codec-cant-decode-bytes-in-position-2-3-trunca

Thank you Techie to give the solution.

Рекомендуемые видео