[Tutor] file?

John Fouhy john at fouhy.net
Tue Apr 4 04:39:12 CEST 2006

On 04/04/06, kakada <hokkakada at khmeros.info> wrote:
> How can we know that one specific file is already exist in filesystem?

Have a look in the os and os.path modules.

In this case, os.path.exists is probably what you want:

if not os.path.exists(inputfilename):
    print 'Oops, file does not exist!'

ziparchive = zipfile.ZipFile(inputfilename, 'r')
# ...


More information about the Tutor mailing list