Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

if statement in one-line for loop python

>>> [(i) for i in my_list if i=="two"]
['two']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #statement #loop #python
ADD COMMENT
Topic
Name
2+3 =