[Tutor] Checking file existance

Roman Suzi rnd@onego.ru
Fri, 23 Aug 2002 10:14:30 +0400 (MSD)


On Fri, 23 Aug 2002, D wrote:

> On Thursday 22 August 2002 23:38, Sean 'Shaleh' Perry wrote:
> 
> > import os.path
> >
> > if os.path.exists(filename):
> >   print "found it"
> 
> if os.path.exists(filename) == 1: # exists
> if os.path.exists(filename == 0: # does not
> 
> alternative: os.path.isfile or os.path.isdir

A better alternative:

os.access(filename, os.F_OK)
 
> regards,
> damir
> 
> 

Sincerely yours, Roman A.Suzi
-- 
 - Petrozavodsk - Karelia - Russia - mailto:rnd@onego.ru -