如何獲取列表中最大長度的子列表?從數組python中選擇最大值
我有這樣的代碼:
c = [1,2]
a = [[1,2], [3,4], [3,2]]
for b in a:
g = len(list(set(b) - set(c))) *#list of difference items between c and b in a*
print(g)
結果
0
2
1
我需要得到b
在a
最長長度>>g = 2
我用
y = [b for b in a if max (g)]
TypeError: 'int' object is not iterable
謝謝