python append to dictionary in loop code example
Example 1: python loop append to dictionary
case_list = []
for entry in entries_list:
case = {'key1': entry[0], 'key2': entry[1], 'key3':entry[2] }
case_list.append(case)
Example 2: how to append to a dictionary in python
d = {'a': 1, 'b': 2}
print(d)
d['a'] = 100 # existing key, so overwrite
d['c'] = 3 # new key, so add
d['d'] = 4
print(d)