conditional print statement ?
"Martin v. Löwis"
martin at v.loewis.de
Wed Apr 25 16:34:33 EDT 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()".
d=Datafile.readline()
if Print_info: print d
It's still two lines, but only has a single call to .readline().
HTH,
Martin
More information about the Python-list
mailing list