假设我有一个字典列表,如下所示:
final_list = [{'city': 'value', 'population': 'value'}, {'city': 'value', 'population': 'value'}, {'city': 'value', 'population': 'value'}]
Run Code Online (Sandbox Code Playgroud)
我有一个看起来像这样的列表:
input_list = [['London', 'New York', 'San Francisco'], [8908081, 8398748, 883305]]
Run Code Online (Sandbox Code Playgroud)
我想正确的价值观,从地图input_list到final_list,但我无法弄清楚如何。我想它会是这样的:
n = 0
while n < len(final_list):
for category in input_list:
for section in final_list:
# then here, somehow say
# for the nth item in each of the sections, update the value to nth item in category
# then increment n
Run Code Online (Sandbox Code Playgroud)
任何帮助将非常感激!提前致谢 :)