SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes

created at 07-03-2022 views: 20


SyntaxError: (unicode error) ‘unicodeescape’ codec can’t decode bytes in position 2-3: malformed \N character escape

It roughly means that the encoder cannot decode the bytes at positions 2-3

The reason for this is generally that when we need the path of the folder as the parameter of the function, the path interval symbol under the windows system is '', and this is also the escape character in python, so there may be errors when identifying,


Add r in front of the path to cancel the effect of the escape character

For example the following path


add r

created at:07-03-2022
edited at: 07-03-2022: