Detect existing files?

Sean 'Shaleh' Perry shaleh at valinux.com
Wed May 2 12:51:17 EDT 2001


> 
> Now my question: Is there a simple way to detect an existing file?
> 

import os
os.path.exists(foo)

check out the documentation for the os.path module -- lots of goodies there.

Oh, and just like C, python has stat() and you can always use that.




More information about the Python-list mailing list