python 一行 if else for

pulplist = [{'box':[1,2,3,4], 'score':0.6},{'box':[1,2,3,4], 'score':0.7},{'box':[1,2,3,4], 'score':0.8},{'box':[1,2,3,4], 'score':0.9}]
returnList = [pulp if pulp['score'] > 0.7 else None for pulp in pulplist]
print(returnList)

posted on 2024-02-22 21:53  张博的博客  阅读(8)  评论(0编辑  收藏  举报

导航