from common.utils.stream import Stream
d = [
[{
"1":"xxx",
"2":"xxx",
"3":"2013",
"4":"555"
},
{
"1":"xxx",
"2":"xxx",
"3":"2014",
"4":"444"
}
], [{
"1":"xxx",
"2":"xxx",
"3":"2015",
"4":"333"
}], [{
"1":"xxx",
"2":"xxx",
"3":"2016",
"4":"222"
}], [{
"1":"xxx",
"2":"xxx",
"3":"2017",
"4":"111"
}],
]
def f(x):
return {"4":x["4"],"time_11":x['3']}
xx = Stream(d).flat_map(lambda x:f(x)).sort_by(lambda y:float(y['time_11']), reverse =True).get()
print(xx)
Stream的学习
猜你喜欢
转载自blog.csdn.net/sinat_26566137/article/details/81075818
今日推荐
周排行