Working with fixed format text db's

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Fri Jun 8 15:13:36 EDT 2007


In <slrnf6iut7.14k.horpner at FIAD06.norwich.edu>, Neil Cerutti wrote:

> new = file("new.dat", "w")
> if not new:
>     print "Error. Could not open file new.dat for writing."
>     raw_input("Press Return To Exit.")
>     sys.exit(1)

Hey, Python is not C.  File objects should *always* be "true".  An error
is handled via exceptions.

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list