Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python filter list of strings

# To support matches from the beginning, not any matches:

items = ['a', 'ab', 'abc', 'bac']
prefix = 'ab'

filter(lambda x: x.startswith(prefix), items)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #filter #list #strings
ADD COMMENT
Topic
Name
3+3 =