Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python one line if without else

>>> myList = []
>>> False and myList.append('myString')
False
>>> myList
[]
>>> True and myList.append('myString')
>>> myList
['myString']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #line
ADD COMMENT
Topic
Name
7+4 =