我正在努力提高python代码的速度。对于大型数据集,执行时间较长。有没有更好的方法来加快速度?在
for i in range(0,len(nodes)):
fragment = nodes[i]
for l in range(0, length1):
fragment1 = Text[l:int(l)+int(k)]
count = [0]*gen_len
for j in range( 0, gen_len ):
if fragment[j] != fragment1[j]:
count[j] = count[j]+1
if j == (gen_len-1):
if int(sum(count)) <= int(Num_mismatches):
count2[i] = count2[i]+1
result2[i] = fragment
result.append(fragment)
if count2[i] > maxval:
maxval = count2[i]
如果使用python3,则将}替换为
izip
替换为zip
,将{range
。在你在很多地方扮演
int
。我删除了它们,因为它们看起来已经是int
(Num_mismatches
,l
,k
)。在相关问题 更多 >
编程相关推荐