fork download
  1. animal_list = [{'animal': 'dog', 'color': 'black'},
  2. {'animal': 'cat', 'color': 'brown'}]
  3. outer_list = ['pet', 'pet']
  4. print([{key: value} for key, value in zip(outer_list, animal_list)])
Success #stdin #stdout 0.09s 14180KB
stdin
Standard input is empty
stdout
[{'pet': {'animal': 'dog', 'color': 'black'}}, {'pet': {'animal': 'cat', 'color': 'brown'}}]