今天寫個腳本定義了一個字元串lbmdir63 = r'C:\svn\Test\lbm\'報錯EOL while scanning string literal,雖然很好找到是\轉義的問題,但是很不了解為什麼原始字元串會有轉義問題,在網上查閱之後原來是python解釋器的缺陷
http://docs.python.org/reference/lexical_analysis.html
String quotes can be escaped with a backslash, but the backslash
remains in the string; for example, r"\"" is a valid string literal
consisting of two characters: a backslash and a double quote; r"\" is
not a valid string literal (even a raw string cannot end in an odd
number of backslashes). Specifically, a raw string cannot end in a single backslash (since the backslash would escape the following quote character).