[Tutor] how to know if a file exists

shawn bright nephish at gmail.com
Thu Jan 4 05:16:40 CET 2007


hello there,
i am writing an app for linux. what command would be easiest to test and see
if a certain file exist ?
i was going to do something like this
try:
    file = open('/path/to/file', 'rb')
    return True
except:
    return False

but i thought that there would be an easier way.
thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070103/f434460b/attachment.html 


More information about the Tutor mailing list