1. 纯python实现: 代码如下: import time def hanoi2(n): cnt = 0 def move(x, y): nonlocal cnt cnt += 1 print("{}: \t{} ---> {}".format(cnt, x, y)) def hano(n, one='A', two='B', three='C'): if n == 1: move(one, three) else: hano(n-1, one