> From: Asrarahmed Kadri <[EMAIL PROTECTED]>
> Date: Oct 12, 2006 9:17 AM
> Subject: Re: [Tutor] Help with basic user-data file
> To: Rob Andrews <[EMAIL PROTECTED]>
> 
> 
> Thanks.
> Can you please also tell me how to check the existence of a file using
> python builtin functions.

If path is a string containing the full path to the file (absolute path 
or relative to the working dir) then use
import os
os.path.exists(path) # To see if the path represents *something* real
os.path.isfile(path) # check for a file specifically
os.path.isdir(path)  # check for a directory

Kent


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to