Is it possible to do this on one line in Python?
if : myList.append(\'myString\')
I have tried the ternary operator:>
myList.extend(['myString'] if condition else []) would also work, though it's more work than the other solutions.
myList.extend(['myString'] if condition else [])