标签:ted 限制 text lin 二分查找算法 python 默认 port pad
n = 0
def recursion():
global n
n += 1
print(n)
recursion()
recursion()
# 结果呈现
1
2
...
995
996
Traceback (most recent call last):
File "C:/Users/thinkpad/Envs/daily_test/test_project/递归函数.py", line 27, in <module>
recursion()
File "C:/Users/thinkpad/Envs/daily_test/test_project/递归函数.py", line 25, in recursion
recursion()
File "C:/Users/thinkpad/Envs/daily_test/test_project/递归函数.py", line 25, in recursion
recursion()
File "C:/Users/thinkpad/Envs/daily_test/test_project/递归函数.py", line 25, in recursion
recursion()
[Previous line repeated 992 more times]
File "C:/Users/thinkpad/Envs/daily_test/test_project/递归函数.py", line 24, in recursion
print(n)
RecursionError: maximum recursion depth exceeded while calling a Python object
import sys
sys.setrecursionlimit(100000)
n = 0
def recursion():
global n
n += 1
print(n)
recursion()
recursion()
# 结果呈现
1
2
...
3924
3925
1 | 2 | 3 |
1 | 2 | 3 |
标签:ted 限制 text lin 二分查找算法 python 默认 port pad
原文地址:https://www.cnblogs.com/xiaoqshuo/p/9706709.html