Python Literal r'\' Not Accepted
r'\' in Python does not work as expected. Instead of returning a string with one character (a backslash) in it, it raises a SyntaxError. r"\" does the same.
This is rather cumbersome if you have a list of Windows paths like these:
paths = [ r'\bla\foo\bar',
r'\bla\foo\bloh',
r'\buff',
r'\',
# ...
]
Is there a good reason why this literal is not accepted?
This is rather cumbersome if you have a list of Windows paths like these:
paths = [ r'\bla\foo\bar',
r'\bla\foo\bloh',
r'\buff',
r'\',
# ...
]
Is there a good reason why this literal is not accepted?
Комментарии
Отправить комментарий