Question
I have a list like this
- myList = [0.0 , 0.0, 0.0, 2.0, 2.0]
- myList.index(2.0)
How-To
Use next with enumerate:
If there is not value as not zero, the None will be returned.
This is a blog to track what I had learned and share knowledge with all who can take advantage of them
>>> 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 方案1: // x -----删除忽略文件已经对 git 来说不识别的文件 // d -----删除未被添加到 git 的路径中的文件 // f -----强制运行 # git clean -d -fx 方案2: 今天在服务器上 gi...
沒有留言:
張貼留言