Does this work? It's not I've proposed. It's step by step. If the file doesn't contain something else...
def get_data(f): data = f.read().split() ecoli = dict() e_name = None for row in data: if row.startswith(">"): e_name = row.strip(">") ecoli[e_name] = "" else: ecoli[e_name] = "{}{}".format(ecoli[e_name], row) return ecoli