“Python Get Index of Substring em Liasta” Respostas de código

Python Get Index of Substring em Liasta

index = [idx for idx, s in enumerate(l) if 'tiger' in s][0]
Calm Crossbill

Python Get Index of Substring em Liasta

def index_containing_substring(the_list, substring):
    for i, s in enumerate(the_list):
        if substring in s:
              return i
    return -1
Calm Crossbill

Respostas semelhantes a “Python Get Index of Substring em Liasta”

Perguntas semelhantes a “Python Get Index of Substring em Liasta”

Mais respostas relacionadas para “Python Get Index of Substring em Liasta” em Python

Procure respostas de código populares por idioma

Procurar outros idiomas de código