【发布时间】:2020-09-18 04:45:45
【问题描述】:
我正在尝试将列表元素添加到列表字典中,我已尽我所能,但无法完成。
字典列表
fortunne_500=[{'Rank': 1,
'Company': 'Walmart',
'Country': 'United States',
'Industry': 'Retail',
'Revenue in USD': '$500 billion'},
{'Rank': 2,
'Company': 'State Grid',
'Country': 'China',
'Industry': 'Power',
'Revenue in USD': '$349 billion'},
{'Rank': 3,
'Company': 'Sinopec Group',
'Country': 'China',
'Industry': 'Petroleum',
'Revenue in USD': '$327 billion'}]
列表
rev_per_emp = [217391.30434782608,376142.84374767606,911953.2812190612]
期望的输出
[{'Rank': 1,
'Company': 'Walmart',
'Country': 'United States',
'Industry': 'Retail',
'Revenue in USD': '$500 billion',
'rev per emp': 217391.30434782608},
{'Rank': 2,
'Company': 'State Grid',
'Country': 'China',
'Industry': 'Power',
'Revenue in USD': '$349 billion',
'rev per emp': 376142.84374767606},
{'Rank': 3,
'Company': 'Sinopec Group',
'Country': 'China',
'Industry': 'Petroleum',
'Revenue in USD': '$327 billion',
'rev per emp': 911953.2812190612}]
如果能帮我完成这件事,我将不胜感激。 谢谢
【问题讨论】:
-
rev_per_emp中值的顺序是否正确?即:rev_per_emp[0]是否总是与fortunne_500的第一个列表值对齐?
标签: python list dictionary append