python處理陣列物件,如何獲取c陣列
uj5u.com熱心網友回復:
a = [{'shunxu': 33.0,'bianhao': 2.0,'chuanbo': 10.0,}, {'shunxu': 17.0,'bianhao': 6.0,'chuanbo': 6.0,}]
b = [{'shunxu': 17.0,'bay': 5,"chuanbo": 6.0,}, {'shunxu': 33.0,'bay': 15,'chuanbo': 6.0,}]
[[i.setdefault('bay', j['bay']) for j in b if i['shunxu'] == j['shunxu']] for i in a ]
print(a)
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/281798.html
