[Tutor] Checking file existance

Rob rob@uselesspython.com
Thu, 22 Aug 2002 16:40:48 -0500


Take a look at the os module and os.path in the Python docs.

Rob

> -----Original Message-----
> From: tutor-admin@python.org [mailto:tutor-admin@python.org]On Behalf Of
> Chris Avery
> Sent: Thursday, August 22, 2002 4:35 PM
> To: tutor@python.org
> Subject: [Tutor] Checking file existance
> 
> 
> Hello all.
> I need to write some code that checks if a file exists.  If it 
> exists, the program continues, but if it doesn't, it get's 
> created.  I'm thinking of an if statement like 
> if file exists:
> 	run rest of program
> else:
> 	create file.
> 
> I just don't know how to check if the file's there.
> 
> Regards,
> Chris
> -- 
> +++++++++++++++++++
> Chris Avery, KC0KTH
> +++++++++++++++++++
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>