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

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

您好,我正在尝试 运行 python 中的一个非常复杂的 cmd 命令,但我一直在标题中收到错误消息!这是命令:

os.system('cmd /c dotnet DicordChatExporter.CLI\DiscordChatExporter.CLi.dll export -t "[insert discord token here]" -c 939905115505180682 -o C:\Users\Danny\DiscordExports\log.txt -f PlainText')

\python 字符串中有特殊含义,所以你需要通过加倍转义它以获得文字 \,所有路径中的所有 \ 应该替换为\,例如

C:\Users\Danny\DiscordExports\log.txt

应该是

C:\Users\Danny\DiscordExports\log.txt