conditional print statement ?

"Martin v. Löwis" martin at
Wed Apr 25 22:34:33 CEST 2007

Stef Mientki schrieb:
> hello,
> As part of a procedure I've a number sequences like this:
> <Python>
>     if Print_Info: print Datafile.readline()
>     else:                Datafile.readline()
> </Python>
> Is there a more compressed way to write such a statement,
> especially I dislike the redundancy "Datafile.readline()".

if Print_info: print d

It's still two lines, but only has a single call to .readline().


More information about the Python-list mailing list