Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

if list element contains string python

matchers = ['abc','def']
matching = [s for s in my_list if any(xs in s for xs in matchers)]

Output:
['abc-123', 'def-456', 'abc-456']
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #list #element #string #python
ADD COMMENT
Topic
Name
1+3 =