python数组处理

若瑆 2021-04-30 05:19:44
python处理数组对象,如何获取c数组
...全文
130 1 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
chuifengde 2021-04-30
  • 打赏
  • 举报
回复
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)

37,743

社区成员

发帖
与我相关
我的任务
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
  • 脚本语言(Perl/Python)社区
  • WuKongSecurity@BOB
加入社区
  • 近7日
  • 近30日
  • 至今

试试用AI创作助手写篇文章吧