在python中满足特定条件时从列表创建新列表

问题描述:

当第3列中的值最高为10%时,我想创建一个新列表。在python中满足特定条件时从列表创建新列表

目前这个样子我列出的清单:

[[1, -1, 10, 0]] 
[[2, 1, 20, 5]] 
[[3, 2, 15, 10], [4, 2, 85, 10], [5, 2, 90, 10]] 
[[6, 3, 75, 11], [7, 4, 78, 11], [8, 5, 80, 11]] 
[[9, 6, 13, 14]] 
[[10, 7, 50, 17]] 
[[11, 8, 70, 30], [12, 8, 95, 30], [13, 8, 90, 30]]..... 

我的线沿线的思考的东西:

M1 = max(row1)[2] (maximum value from the 3rd column) 

if row1[i][2] >= M1*(0.1): 
    newrow1.append() 

任何帮助将不胜感激!在此先感谢名单

+0

你可以发表你的期望的输出? –

+0

也不清楚你的输入是什么(你提到一个列表的列表,但你写的是单独的列表) –

名单应该是[],[],...]

您可以使用此:

#l is the list of lists 

[item for item in l if item[2]>10]