|
|
|
|
|
by _alexh_AS_
2838 days ago
|
|
Python 3.6.6 (tags/v3.6.6:4cf1f54eb7, Jul 6 2018, 15:35:19)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> conditionA = True
>>> attr = "foo" if conditionA else "bar"
>>> print(attr)
foo
>>> conditionA = False
>>> attr = "foo" if conditionA else "bar"
>>> print(attr)
bar
>>>
|
|