Code: Select all
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)
< /code>
Ich bekomme < /p>
'dict' object has no attribute 'append'
< /code>
In dieser Zeile < /p>
my_dict.append({
zu erstellen
Code: Select all
my_dict = []
< /code>
, hat aber < /p>
bekommenlist indices must be integers or slices, not str
< /code>
In dieser Zeile < /p>
my_dict["z_index"].append(z_list)
Danke!
Mobile version