Possible Duplicate:
Ternary conditional operator in Python
var foo = (test) ? "True" : "False";
What would this look like in Python?
Using Python 2.7 if that makes a difference.
PEP 308 adds a ternary operator:
foo = "True" if test else "False"
It's been implemented since Python 2.5
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With