Very simple fastA reader.
from bfasta import FastAreader
reader = FastAreader("myFile.fa")
# If you want to just read the first entry
header, seq = next(reader.readFasta())
# header and seq are now simple strings
print(header)
print(seq)
# If you want to read all the entries
for header, seq in reader.readFasta():
print(header)
# process further
Before trying the code above, in your terminal, type
pip install bfasta
Originally by Dr. B.