Код: Выделить всё
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>
Я получаю < /p>
'dict' object has no attribute 'append'
< /code>
На этой строке < /p>
my_dict.append({
Код: Выделить всё
my_dict = []
< /code>
Но получил < /p>
list indices must be integers or slices, not str
< /code>
На этой строке < /p>
my_dict["z_index"].append(z_list)
Спасибо!
Подробнее здесь: https://stackoverflow.com/questions/794 ... ore-a-list