- I know that you can create a multi-line string in several ways:
Triple quotes
''' This is a multi-line string. '''
concatenation
('this is ' 'a string')
Shielding
'This is'\ 'a string'
I also know that prefixing a string with r will make it the original string, useful for file paths.
r'C:\Path\To\File'
However, I have a long path to a file that spans several lines and should be unprocessed. How to do it?
It works:
In [1]: (r'a\b' ...: '\c\d') Out[1]: 'a\\b\\c\\d'
But for some reason this is not the case:
In [4]: (r'on\e' ...: '\tw\o') Out[4]: 'on\\e\tw\\o'
Why does "t" only have a backslash?
Josh d
source share