我发现这个可能非常有用的 python script , 但遇到了我以前从未见过的这些表达式:
inputfilename = r'/path/to/infile'
outputfilename = r'/path/to/outfile'
我找不到搜索它的方法。 r'...'
做什么?
感谢您的帮助!
最佳答案
r'..'
字符串修饰符导致 '..'
字符串被解释为字面意义。这意味着,r'My\Path\Without\Escaping'
将评估为 'My\Path\Without\Escaping'
- 不会导致反斜杠转义字符。先验等效于 'My\\Path\\Without\\Escaping'
字符串,但没有原始修饰符。
注意:字符串不能以奇数个反斜杠结尾,即r'Bad\String\Example\'
不是正确的字符串。
关于python - 未知的 python 表达式 filename=r'/path/to/file',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19034822/