On Thu, 30 Aug 2007 04:30:50 -0400, mr_gadget wrote: > C:\>python -c "import os; print os.path.exists('C:\enhancement\rawfiles')" > > False > > C:\>python -c "import os; print os.path.exists('C:\\enhancement\\rawfiles')" > > True
The backward slash has a special meaning in string literals. It is used to escape special character. One such sequence is '\r' which is *one* character, namely the return character. To insert *one* backslash it has to be protected by another backslash or the string literal may be prefixed by an 'r' to tell the compiler that backslashes have no special meaning in that raw string literal. In [23]: len('\r') Out[23]: 1 In [24]: len('\\') Out[24]: 1 In [25]: len(r'\r') Out[25]: 2 In [26]: len(r'\\') Out[26]: 2 Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list