用for循环遍历列表 如何让满足条件的数据拿出后在列表中删除,下一次寻找时的次数变少
b=[]
for temp in a:
for ele in dataele:
if temp==ele[0]:
#save the node number in this element
point1 = ele[1]
for nh in datanode:
if nh[0] == point1:
b.append(nh[3])
continue
# if nh == datanode[-1] and nh[0]!=point1:
# print(point1)
continue
多重循环速度太慢
想提高运行速度
continue毫无意义,改成break
如果你需要去list里筛选数据,你一开始定义成dict不就好了,复杂度O(1)