Two problems with backslashes

Gustaf Liljegren gustafl at algonet.se
Wed Jul 4 11:10:55 EDT 2001


Skip Montanaro <skip at pobox.com> wrote:

> Your first statement should be either
> 
>     path = 'e:\\test\\test.txt'
> 
> or
> 
>     path = r'e:\test\test.txt'

Forgot to tell you one thing: I get these paths from user input (arguments 
to getopt.getopt()), so I have no control on this. Have looked for a 
function to convert a string to a raw string, but couldn't find any. I'll 
take a closer look on os.path now.

Regards,

Gustaf Liljegren



More information about the Python-list mailing list