I could not find a clear answer to my question, so I try to explain myself with code. my_dict = {} for i in range(10): z_list = [] for j in range(10): if i>3: my_dict.append({ "i_index": i, "j_index": j, "z_index":[] }) else: z_list.append([i, j, i+j]) my_dict["z_index"].append(z_list) I get 'dict' object has no attribute 'append' at this line my_dict.append({ So I tried to make my_dict a list my_dict = [] but got list indices must be integers or slices, not str at this line my_dict["z_index"].append(z_list) how can I solve the problem? Thank you! Continue reading...