擅长:python、mysql、java
<p>可能这就是你要找的东西</p>
<pre><code>def find_postpep_site(string, lastindex=0):
if(re.search('(G[RK])|(GKR)|(G$)', string)):
lastindex = (re.search('(G[RK])|(GKR)|(G$)', string)).end()
find_postpep_site(string[lastindex:10000], lastindex)
else:
return lastindex
</code></pre>
<p>从主程序调用时,lastindex是可选的,如果未提供,将假定为0。否则,递归调用时,将在函数调用中传递lastindex</p>
<p>然而,我想指出的是,我认为您可能在这里也遗漏了一条返回语句:</p>
<pre><code>return find_postpep_site(string[lastindex:10000], lastindex)
</code></pre>
<p>否则,在递归情况下将永远不会返回任何内容</p>