How to condense if/else into one line in Python?

Possible Duplicate:
Python Ternary Operator
Putting a simple if-then statement on one line

Is there a way to compress an if/else statement to one line in Python?
I oftentimes see all sorts of shortcuts and suspect it can apply here too.

Leave a Comment