Python 迭代最大次數是多少?

RecursionError: maximum recursion depth exceeded while calling a Python objectit

def foo(n):
    print(n)
    n = n + 1
    foo(n)


if __name__ == '__main__':
    foo(1)

 997io

歡迎自測import

 

import sys

sys.setrecursionlimit(2000)


def foo(n):
    print(n)
    n = n + 1
    foo(n)


if __name__ == '__main__':
    foo(1)
相關文章
相關標籤/搜索