I have the next list of
testList = []
testList.append([0,-10])
testList.append([-12,122])
testList.append([13,172])
testList.append([17,296])
testList.append([-10,80])
testList.append([-16,230])
testList.append([-18, 296])
testList.append([-2, -8])
testList.append([-5,10])
testList.append([2,-4])
还有一个包含前面列表元素的另一个列表:
m1 = []
m1.append([0, -10])
m1.append([13, 172])
接下来我尝试使用以下语句从列表testList
获取子数组:
[element for i, element in enumerate(testList) if i not in m1]
但是我得到的列表和
testList
相同。如何实现这一点?
[element for i, element in enumerate(testList) if element not in m1]
- Kamejoin