我想在每个单独的列表之前打印带有数字的列表列表。基本上,我想更改每一行,使 row[0] 前面有一个数字,然后通过 .join() 运行该行。如果不实际编辑我的主列表板中的行,我该如何做到这一点?
board = [["-"]*9 for i in range(9)]
def print_board(board):
counter = 0
for row in board:
counter += 1
row_for_printing = row
row_for_printing [0] = str(counter) + " " + row[0]
print " ".join(row_for_printing)
print " "