python数独游戏报错:list indices must be integers or slices, not str

初学者 python数独游戏报错:list indices must be integers or slices, not str

在检测玩家输入填充目标是否可用时报错
position = (int(row), int(column))
if origin_board[row][column] is not None:
print(INVALID_MOVE_MESSAGE)
origin_board是指原始数独题目

if origin_board[row][column] is not None:

改为:

if origin_board[int(row)][int(column)] is not None:

试试

这篇文章:python报错 list indices must be integers or slices, not tuple 也许有你想要的答案,你可以看看