f=open('sequence3.fasta', 'r')
str=''
for line in f:
line2=line.rstrip('\n')
if (line2[0]!='>'):
str=str+line2
elif (len(line)==0):
break
str.rstrip('\n')
f.close()
スクリプトは、3 つの DNA シーケンスを読み取り、それらを 1 つのシーケンスに接続することを想定しています。問題は、次のエラーが発生することです。
IndexError: string index out of range
そして、私がこのように書くとき:
f=open('sequence3.fasta', 'r')
str=''
for line in f:
line.rstrip('\n')
if (line[0]!='>'):
str=str+line
elif (len(line)==0):
break
str.rstrip('\n')
f.close()
実行されますが、間にスペースがあります。ありがとう