SyntaxError: (unicode error) ‘unicodeescape‘ codec can‘t decode bytes in position 6-7: malformed

created at 12-12-2021 views: 98

problem

input_image_path ='Inputs\Nnu01.jpg'
                      ^
SyntaxError: (unicode error)'unicodeescape' codec can't decode bytes in position 6-7: malformed \N character escape

Ideas

Syntax error: (unicode error) The unicode escape codec cannot decode the bytes at positions 6-7: incorrectly formatted \n character escape

Solution

The escape character problem, the problem caused by \n in the string! It needs to be modified as follows, just add r in front!

input_image_path = r'Inputs\Nnu01.jpg'

Haha, you're done!

created at:12-12-2021
edited at: 12-12-2021: