#1
|
|||
|
|||
Check if file exists
Is there a way to check if a file exists in the current directory through code?
I don't want to access this file per say, I just want to verify that it already exists in the directory. Thanks, Jassel41 |
#2
|
|||
|
|||
You can use the os.path.isfile command to check for file existence.
Code:
import os if os.path.isfile('foo.txt'): print 'File exists' |
#3
|
|||
|
|||
That's perfect, thank you so much.
|
Thread Tools | |
Display Modes | Rate This Thread |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Closing of an imported .py file | Uttama_vizard | Vizard | 2 | 05-04-2010 06:18 AM |
IVEx file extenstion unrecognised. | sindi | Vizard | 2 | 12-10-2009 01:20 AM |
writing joystick position to a data file | Saz | Vizard | 3 | 12-17-2008 05:18 AM |
Read file....many issues | Uttama_vizard | Vizard | 9 | 07-08-2008 02:16 PM |
File Management | Uttama_vizard | Vizard | 2 | 07-01-2008 09:44 AM |