Two problems with backslashes

Emile van Sebille emile at fenx.com
Wed Jul 4 11:28:29 EDT 2001


#test.py:
import getopt, sys
print getopt.getopt(sys.argv[1:], "")

F:\Python21>python test.py c:\test
([], ['c:\\test'])

So it appears to work here using getopt.  Something else must be going on.
Can you post an example that generates the string with the embedded tabs?


--

Emile van Sebille
emile at fenx.com

---------
"Gustaf Liljegren" <gustafl at algonet.se> wrote in message
news:Xns90D4AEEA4B92Agustaflalgonetse at 194.213.69.152...
> 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