Outline
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
When reading pickle file, the above error is reported
Pickle file path is copied directly, no problem
So was confused and finally found a solution on the Internet, so he made a record:
Solution
The picture above shows the error message and the file path
It seems that there is no problem, but the problem still appears in the path
Because in Windows system, the “\” in the path will be escaped
For example, if you configure a path: D:// source <XXX/a.txt, the system will escape the “ ” to a tab key, so that the file path is wrong
The correct path should be:
The first way to write: D:\\source\\\t\\xxx\\\a.txt
Second way to write: r "D:\source\t\xxx\\a.txt"
The third way to write: D:/source/t/xxx\a.txt # Path writing in Linux
the third writing method is recommended because it is common in windows and Linux