DNA序列:
ATGGTCTACATAGCTGACAAACAGCACGTAGCAATCGGTCGAATCTCGAGAGGCATATGGTCACATGATCGGTCGAGCGTGTTTCAAAGTTTGCGCCTAG
内含子1:ATCGGTCGAA
内含子2:ATCGGTCGAGCGTGT
剪切之后的拼接结果为:
ATGGTCTACATAGCTGACAAACAGCACGTAGCATCTCGAGAGGCATATGGTCACATGTTCAAAGTTTGCGCCTAG
dna1 = "ATGGTCTACATAGCTGACAAACAGCACGTAGCAATCGGTCGAATCTCGAGAGGCATATGGTCACATGATCGGTCGAGCGTGTTTCAAAGTTTGCGCCTAG" dna2 = "ATCGGTCGAA" dna3= "ATCGGTCGAGCGTGT" a = dna1.index(dna2) b = dna1[:a]+dna1[a+len(dna2):] c = b.index(dna3) d = b[:c]+b[c+len(dna3):] print(d)
注意字符串的index方法:
>>>dna1='ABCDEF' >>>index=dna1.index('CDE') >>>index 2