import numpy as np
import pandas as pd
data=[]
f= open('ls_orchid.fasta.csv')
running= True
while running:
first_line = f.readline()
if first_line == ' ' : break
l=[first_line.strip()]
s=' '
for line in f:
s+= line.strip()
if line == '\n':
break
l.append(s)
data.append(l)
f.close()
If you type data(0), you should get the data corresponding to the first paragraph of the file IndexError: list index out of range appears The file was changed to the csv extension and used If I type len(data), the number of data should come out, but it comes out as 0. What's wrong with that?
python
l=[first_line.strip()] I recommend you to print (first_line) before and try debugging slowly
It's okay to learn a debugger called pdb, but I think it'll be okay to use print.
© 2024 OneMinuteCode. All rights reserved.