我知道我們可以在字符串之前使用r(原始字符串)和u(unicode)標誌來獲得我們實際需要的內容。但是,我想知道這些如何處理字符串。我在空閒試過這樣: a = r"This is raw string and \n will come as is"
print a
# "This is raw string and \n will come as is"
help(r)
# ..... W
編輯問題: 我正在寫一個python函數,它從windows中複製粘貼一個路徑的字符串(所以用反斜槓),並返回一個帶有正斜槓的字符串,可用於由python作爲路徑。與側隙和其他字符的組合,就會出現問題,比如\ n \ b ... 感謝Coldspeed,我現在有一個函數類的,做的伎倆: def back2forwardSlash(backSlash_string):
return ba