?: in Python

Andy Leszczynski yahoo at nospam.leszczynscy
Wed Dec 14 14:09:10 EST 2005


How can do elegantly in Python:

if condition:
    a=1
else:
    a=2

like in C:

a=condition?1:2




More information about the Python-list mailing list