Код: Выделить всё
class test(object):
def __init__(self, name):
self.name = ''
testList = [(test("empty") for i in range(3)) for j in range(2)]
for m in range(3):
for n in range(2):
testList[m][n].name = "changed"
Код: Выделить всё
Traceback (most recent call last):
File "test.py", line 12, in
testList[m][n].name = "changed"
TypeError: 'generator' object is not subscriptable
Подробнее здесь: https://stackoverflow.com/questions/567 ... l-with-2-d
Мобильная версия