2024-04-19 22:13:21 发布
网友
我建立了一个网站和用户可以输入目录路径的形式。在
我的程序将提取路径并写入一个文件。在
我的问题是,当路径包含某些特殊单词时,例如\t\n,程序无法正确写入文件。在
例如: C: \abc\test将变为C:\abc[TAB]est
如何将字符串更改为其他类型(如原始字符串)并正确写入文件?在
谢谢你的答复。在
... user can enter directory path in form....My question is when the path include some special word such as \t \n, the program can't write file correctly.
... user can enter directory path in form.
...
My question is when the path include some special word such as \t \n, the program can't write file correctly.
呃,没有。Python完全能够区分'\t'和{},除非你在做一些事情来混淆它。在
'\t'
输入字符串时使用r'C:\abc\test'或{}
r'C:\abc\test'
呃,没有。Python完全能够区分},除非你在做一些事情来混淆它。在
^{1}$'\t'
和{输入字符串时使用}
r'C:\abc\test'
或{相关问题 更多 >
编程相关推荐