Detect existing files?

Roman Suzi rnd at
Wed May 2 13:24:57 EDT 2001

On 2 May 2001, Michael Hudson wrote:

>schulz at Informatik.TU-Muenchen.DE (Stephan Schulz) writes:
>> Now my question: Is there a simple way to detect an existing file?

I am using glob.glob(file) usually - and it is the slowest method :-(
The fastest is os.access (for cases where there is no
file in large dir - MUCH faster).
and os.path.exists is in the middle.

(checked on Linux 2.2,
repeated access to the same file)

Sincerely yours, Roman Suzi
_/ Russia _/ Karelia _/ Petrozavodsk _/ rnd at _/
_/ Wednesday, May 02, 2001 _/ Powered by Linux RedHat 6.2 _/
_/ "Cats have nine lives - but sleep through eight of them." _/

More information about the Python-list mailing list