Vérifiez la chaîne dans une liste pour les sous-chaînes et l'index de retour

def get_index(list_of_strings, substring):
    try:
        return next(i for i, e in enumerate(list_of_strings) if substring in e)
    except StopIteration:
        return len(list_of_strings) - 1
Real Raccoon