Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python get index of substring in liast

def index_containing_substring(the_list, substring):
    for i, s in enumerate(the_list):
        if substring in s:
              return i
    return -1
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #index #substring #liast
ADD COMMENT
Topic
Name
5+6 =