Independent objects needed when zipping into dict
问题 I have a list of items: my_list = ['first', 'second', 'third'] I need to convert this items into a dictionary (so I can access each element by it's name), and associate multiple counters to each element: counter1, counter2, counter3. So I do the following: counter_dict = {'counter1': 0, 'counter2': 0, 'counter3': 0} my_dict = dict(zip(mylist, [counter_dict]*len(mylist))) This way I obtain a nested dictionary { 'first': { 'counter1': 0, 'counter2': 0, 'counter3': 0 }, 'second': { 'counter1': 0