python next occurence in list code example
Example: python return first list element that contains substring
# Example usage:
your_list = ['The answer to', 'the ultimate question', 'of life',
'the universe', 'and everything', 'is 42']
[idx for idx, elem in enumerate(your_list) if 'universe' in elem][0]
--> 3 # The 0-based index of the first list element containing "universe"