I have a list like this
Use next with enumerate:
If there is not value as not zero, the None will be returned.
>>> 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 # The first index to have value with true value which means not zero
Source From Here Question Im trying to figure out a way to get the time difference in seconds between two dates . For example, diff...