天天看點

python RuntimeError: maximum recursion depth exceeded

使用 python做爬蟲時遇到 RuntimeError: maximum recursion depth exceeded;

原因:python預設的遞歸深度是很有限的,1000左右

解決辦法之一:手動設定python的遞歸深度

  1. import sys   
  2. sys.setrecursionlimit(10000) #設定為一萬  

 其他辦法就是不用遞歸咯