mardi 7 juillet 2020

IndentationError: expected an indented block (this pops up after I add in the "IF" in the IF loop)

I wrote this short script to automatically print out strings in csv that contains "1|1". However, when I added in the if status=='1|1', the indentation error happened. I'm quite new to this, anyone can help?


inputfile = csv.reader(open('varStatus__case2_2Np_2N_hd1_Fx8Np_3L.csv','r'))
outputfile = open('errorlist.txt','w')

i=0

for row in inputfile:
    if (i > 5):
    name = row[1]
    status = row[0]
    if (status == '1|1'):
    print >>outputfile, name, status
    i+=1

I'm using python on UNIX

Aucun commentaire:

Enregistrer un commentaire