我尝试将python中字段的第一个值更改为true。我做错什么了?整个专栏都变了,我不明白为什么
我的代码:
def selectElement(self, col, row):
print(col, row)
print(self)
self.field[col][row] = True
print(self)
def __str__(self):
out = '\n'
for col in self.field:
for value in col:
out += str(value) + ' '
out += '\n'
return out
输出:
0 0
False False False
False False False
False False False
True False False
True False False
True False False
列表的首字母为:
self.list = [[False] * size] * size
我用了:
相关问题 更多 >
编程相关推荐