[EMAIL PROTECTED] wrote:
> I have the simplest need...to read a file full of file names(unc) and
> then check to see if each of these files exists.  I tried with the
> following program, but always get file not found, even when it is
> there. If I type in the file name as a literal it works...
> 
> Little program:
> 
> #This module checks for file existence
> import string
> import sys
> 
> def MainProcess():
> 
>     fileList = "c:\a_list_of_filenames.txt"

\ is the escape character in strings, so if you need an actual backslash, you 
need to double it:

   fileList = "c:\\a_list_of_filenames.txt"

or use "raw" string literals, which don't do any escaping:

   fileList = r"c:\a_list_of_filenames.txt"

Please see the tutorial:

   http://docs.python.org/tut/node5.html#SECTION005120000000000000000

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to