Working with fixed format text db's

Marc 'BlackJack' Rintsch bj_666 at
Fri Jun 8 21:13:36 CEST 2007

In <slrnf6iut7.14k.horpner at>, 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.

	Marc 'BlackJack' Rintsch

More information about the Python-list mailing list