def read_title_and_seq(filename):
 with open(filename) as handle:
  title = handle.readline().rstrip()
  assert title.startswith('>')
  seq = ''
  for line in handle:
   if line.startswith('>'):
    break
   seq += line.strip()
 return (title[1:], seq)

def read_title_and_seq ( filename ) : with open ( filename ) as handle : title = handle . readline ( ) . rstrip ( ) assert title . startswith ( '>' ) seq = '' for line in handle : if line . startswith ( '>' ) : break seq += line . strip ( ) return ( title [ 1 : ] , seq )
crude parser that gets the first record from a fasta file .