Variable in dictionary

I want to replace CHANGE with the variable zone_list.

output_zones = {'CHANGE' : {}}

I would like to get:

{'zone_name': {... a set of dictionaries...}}

What is the correct syntax? This code is wrong:

zone_list = zone_name
output_zones = {f"{zone_list}:", {}}
output_zones[zone_list].update(zone_info)

>Solution :

try this:

output_zones = {'{}'.format(zone_list): {}}

Leave a Reply