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 I have a directory on my system which is used for a specific reason by applications and users , but I d...