Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python remove items from list containing string

>>> l = ['1', '32', '523', '336']
>>> [ x for x in l if "2" not in x ]
['1', '336']
>>> [ x for x in l if "2" in x ]
['32', '523']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #remove #items #list #string
ADD COMMENT
Topic
Name
7+4 =