【发布时间】:2014-06-18 16:06:30
【问题描述】:
我正在尝试通读文本文件的行以拆分和提取 # 符号之间的字符串。当我运行我的代码时,我收到了错误
RuntimeError: maximum recursion depth exceeded
下面是我的代码,任何帮助将不胜感激。谢谢!
#function
def parameterPull(line):
if line.count('#') > 0:
temp = eachLine.split('#',1)[1]
temp2 = temp.split('#',1)[0]
temp3 = temp.split('#',1)[1]
#write these scripts to a file
parameterFile.write('\n'+temp2+'\n')
#check for multiple instance on the same line
if temp3.count('#') > 0:
parameterPull(temp3)
#make replacements
for eachLine in resultFile:
parameterPull(eachLine)
parameterFile.close()
【问题讨论】:
标签: python recursion runtime-error