亲爱的所有人,我有一个关于测试DNA序列中的基序出现的简单脚本的小问题。
首先,它没有任何函数,但当我移动函数下代码的If语句时,在调用此函数后出现错误
def Motif(Motif, Seq):
if Motif in Seq:
print "!!!wwWOOHOOOoo!!!" +('\n')+ "%s has been detected!!!"%(Motif)+('\n')+"wWOOOHOOOoo!!"
# Script here
Seq = raw_input('Please paste the DNA sequence here:')
Motif = raw_input('Please type the DNA motif here:')
Motif(Motif, Seq)回溯(最近一次调用):文件"",第1行,文件"simple.py",第13行,Motif(Motif,Seq) TypeError:'str‘对象不可调用
我应该在这段代码中修复什么?
发布于 2014-04-01 18:07:14
您将Motif重新绑定到一个字符串:
Motif = raw_input('Please type the DNA motif here:')这将屏蔽Motif函数;请使用不同的名称。
raw_input()函数是同一名称空间中的对象;Python要么引用函数,要么引用Python返回值,而不是两者都引用。
https://stackoverflow.com/questions/22782664
复制相似问题