#filehandling #reading
def read_fasta_sequences(file_path):
sequences = []
with open(file_path, 'r') as file:
for line in file:
line = line.strip()
if not line.startswith(' '):
sequences.append(line)
return sequences
Replace 'your_file.fasta' with the path to your FASTA file
file_path = 'your_file.fasta'
sequences = read_fasta_sequences(file_path)
Print the sequences
for seq in sequences:
print(seq)
Негізгі бет Read file in python using function - Code in description
Пікірлер