Possible Duplicate:
Pythonic way to check if a file exists?
How to check if a file exists in python?
Scripting in Windows
Possible Duplicate:
Pythonic way to check if a file exists?
How to check if a file exists in python?
Scripting in Windows
 
    
     
    
    This is very easy using the os module.
from os.path import exists
print exists("C:\somefile.txt")
 
    
    Check the manual, this is a really easy question:
http://docs.python.org/library/os.path.html#os.path.exists
os.path.exists(path)Return True if path refers to an existing path. Returns False for broken symbolic links. On some platforms, this function may return False if permission is not granted to execute os.stat() on the requested file, even if the path physically exists.
 
    
    http://docs.python.org/library/os.path.html#os.path.exists
or if you want to also ensure that said path is actually a file (as opposed to a directory, link, etc):
