我试图设置多维数组中包含的单元格的类属性Board.grid板. 我收到以下错误消息:
File "newbs1.py", line 133, in get_and_set_board_item
self.grid[x, y].set_cell(value, secondary)
File "newbs1.py", line 129, in __getitem__
return self.grid[x][y]
File "newbs1.py", line 128, in __getitem__
x, y = tup
TypeError: 'int' object is not iterable
让x和y输入他们是如何从别人的帖子来的想法,它解决了他们的问题,但对我来说不起作用。在
^{pr2}$
我不确定其余代码的外观,但在线路:133,
self.grid[(x, y)].set_cell(value, secondary)
,看起来元组(x, y)
不是一个单元格类型。在也许可以试试:
相关问题 更多 >
编程相关推荐