このボードを中央に配置しようとしています。これはコードです。%* sで試しましたが、うまくいきませんでした。何か案が?
board = [["1","2","2"],["8*1","2@3","5*6"],["9","5","8"],["2","2","2"],
["5*6","6*8","0@2"],["1","2","8"],["1","9","8"],["2*7","7*5","4@2"],["1","3","3"]]
counter = 0
print("--------------+---------------+-------------------")
for row in board:
counter += 1
print("|" "%s" "|") % (" | ".join(row).center(47))
if counter == 3 or counter == 6 or counter == 9:
print("---------------+---------------------+--------------")
すべてのボックスの出力は次のようになります
+-----------+
| 1 | 1 | 9 |
|2@3|1*6|7*2|
| 4 | 1 | 2 |
+-----------+