1 def p(n): 2 print(n) 3 p(n+1) 4 p(1) 5 6 7 # RecursionError: maximum recursion depth exceeded while calling a Python object
import sys sys.setrecursionlimit(10000) # 可以解除递归998层报错的设置