I have a file that looks like this:
>sequence_name_16hj51
CAACCTTGGCCAT
>sequence_name_158ghni52
AATTGGCCTTGGA
>sequence_name_468rth
AAGGTTCCA
I would like to obtain this:
['CAACCTTGGCCAT', 'AATTGGCCTTGGA', 'AAGGTTCCA']
I have a list with all the sequence names titled title_finder
. When I try to use:
for i in range(0,len(title_finder)):
seq = seq.split(title_finder[i])
print seq
I get this traceback:
Traceback (most recent call last):
File "D:/Desktop/Python/consensus new.py", line 23, in <module>
seq = seq.split(title_finder[i])
AttributeError: 'list' object has no attribute 'split'
Can somebody help me out?
EDIT: Sometimes some sequences span multiple lines and so I get more than one string when I do it with a for loop.