Detect existing files?

Stephan Schulz schulz at Informatik.TU-Muenchen.DE
Wed May 2 12:30:59 EDT 2001


Hi all,

since I have an intense aversion to Perl, I have up to now worked with
gawk and shell programms. Now I am in the process of converting some
of my accumulated scripts to Python (for better clarity and for better
performance).

Some things still seem fairly strange, but all in all the language
seems to work for me - although not quite as good as Scheme or C ;-)

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

open() seems to raise an error if the file does not exist, which is
kind of overkill for me.

os.open() may work, but I could not find a good description of it -
the library reference omits the case of a non-existing file.

Thanks,

       Stephan 

-- 
-------------------------- It can be done! ---------------------------------
   Please email me as schulz at informatik.tu-muenchen.de (Stephan Schulz)
----------------------------------------------------------------------------



More information about the Python-list mailing list