Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

else statement python list comprehension

>>> [a if a else 2 for a in [0,1,0,3]]
[2, 1, 2, 3]
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #statement #python #list #comprehension
ADD COMMENT
Topic
Name
1+9 =