python 函数基础

定义:

def intersect(seq1,seq2):
res = []
for x in seq1:
if x in seq2:
res.append(x)
yield res

运行效果

>>> s1 = "ATGC"
>>> s2 = "TGC"
>>> intersect(s1,s2)
<generator object intersect at 0x01AF7288>
>>> for i in intersect(s1,s2):
print i

['T', 'G', 'C']
>>>

上一篇:004.Docker镜像管理


下一篇:PCL点云库:ICP算法