Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

pick the element from list whihc matched with sub string

mylist = ['abc123', 'def456', 'ghi789']
sub = 'abc'
next((s for s in mylist if sub in s), None) # returns 'abc123'
 
PREVIOUS NEXT
Tagged: #pick #element #list #whihc #matched #string
ADD COMMENT
Topic
Name
3+7 =