Testing for a file in python?

Moshe Zadka moshez at math.huji.ac.il
Mon Jun 12 13:10:48 EDT 2000


On Mon, 12 Jun 2000, Thaddeus L. Olczyk wrote:

> How would you go about testing if a certain file exists in python?
> In most scripting languages you have the -f test:

I don't know what you mean by "most".

> stat doesn't work, it aborts if the file does not exist.

Why not use os.path.isfile()?

--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com





More information about the Python-list mailing list