Is it possible to do this on one line in Python?
if :
myList.append(\'myString\')
I have tried the ternary operator:>
if : myList.append('myString')
Otherwise, no. Why the need to put it on one line?
Note that the "ternary operator" is an operator. Like any operator, it must return something, so how can you have a ternary operator without the else clause? What is it supposed to return if the condition isn't true-like?