FInding files with python

Stefan Antoni sasoft at gmx.de
Sun Oct 28 10:28:16 EST 2001


On Sun, Oct 28, 2001 at 04:23:40AM -0000, Widgeteye wrote:

> If (file exists)
>   do the following
> 
> But I can't figure out how to test for the file..   
> help??
> 
try the following:

import os

os.path.isfile("/mypath/to/myfile")

this returns 1 or 0.

-- 
Stefan Antoni





More information about the Python-list mailing list