(For the purpose here, I'm using Python 2.7.13 on Windows.)
I was told that user input strings are automatically read as raw string literal here. However, using a simple example:
def test (filename):
return(os.path.normpath (filename))
test('Y:\Projects\14. MOON-301\Neoantigen\normal-10NB-tumor-10TB\normal-10NB-tumor-10TB-lib.txt')
'Y:\\Projects\x0c. MOON-301\\Neoantigen\normal-10NB-tumor-10TB\normal-10NB-tumor-10TB-lib.txt'
Which acts like normpath
is treating filename
as a string literal rather than a raw string literal. Of course I can use eval
to coerce it back into raw string literals, but is there a more elegant way to do it?