天天看点

python RuntimeError: maximum recursion depth exceeded

使用 python做爬虫时遇到 RuntimeError: maximum recursion depth exceeded;

原因:python默认的递归深度是很有限的,1000左右

解决办法之一:手动设置python的递归深度

  1. import sys   
  2. sys.setrecursionlimit(10000) #设置为一万  

 其他办法就是不用递归咯