且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

(unicode错误)'unicodeescape'编解码器无法解码位置2-3中的字节:truncated \UXXXXXXXX escape

更新时间:2022-06-13 15:16:47

字符串中的第一个反斜杠被解释为一个特殊字符,事实上,后面跟着一个U它被解释为一个unicode代码点的开始。

The first backslash in your string is being interpreted as a special character, in fact because it's followed by a "U" it's being interpreted as the start of a unicode code point.

为了解决这个问题,你需要转义字符串中的反斜杠。知道Python,但我想你通过加倍反斜杠来做到这一点:

To fix this you need to escape the backslashes in the string. I don't know Python specifically but I'd guess you do it by doubling the backslashes:

data = open("C:\\Users\\miche\\Documents\\school\\jaar2\\MIK\\2.6\\vektis_agb_zorgverlener")