当我在代码下面运行时,为什么会出现"无效语法".Python 2.7
from string import *
def countSubStringMatch(target,key):
counter=0
fsi=0 #fsi=find string index
while fsi<len(target):
fsi=dna.find(key,fsi)
if fsi!=-1:
counter+=1
else:
counter=0
fsi=fsi+1
fsi=fsi+1
#print '%s is %d times in the target string' %(key,counter)
def countSubStringMatch("atgacatgcacaagtatgcat","atgc")
Run Code Online (Sandbox Code Playgroud)
在线:
def countSubStringMatch("atgacatgcacaagtatgcat","atgc")
Run Code Online (Sandbox Code Playgroud)
你应该删除def.def在定义函数时使用,而不是在调用函数时使用.