I have a list like this
myList = [0.0 , 0.0, 0.0, 2.0, 2.0]
I would like to find the location of the first number in the list that is not e
Use next with enumerate:
next
enumerate
>>> myList = [0.0 , 0.0, 0.0, 2.0, 2.0] >>> next((i for i, x in enumerate(myList) if x), None) # x!= 0 for strict match 3