【发布时间】:2014-07-29 22:20:08
【问题描述】:
所以当我尝试制作 2D 网格时出现此错误。我知道它说我的列表中似乎没有 5 行。那是错误。这是我尝试过的:
board = ["O", "O", "O", "O", "O"]
def create_board(width, height, empty='O'):
for x in range(5):
board.append(board)
return board
return
a = create_board(5, 5)
print(a) # show "empty" board that was created
【问题讨论】:
-
如果您的问题与 Java 无关,为什么要花这么多的时间提 Java?
-
你能提供一些你尝试过的例子吗?
标签: python list python-3.x