> And here is my I got work for me in Python. > > === > === > import sys > infile=sys.argv[1] > outfile=sys.argv[1]+".csv" > > f1=open(infile) > f2=open(outfile, 'w') > > s2="" > > for line in f1: > s=line.strip() > if s=="": > continue > elif s==".block": > continue > elif s==".report": > continue > elif s==".endblock": > s="\n" > s2=s2[:-1]+s > f2.write(s2) > s2="" > continue > s2=s2+"\""+s+"\""+"," > > f1.close() > f2.close() > === > ===
Indentation is paramount in python. Your QBasic code is indented in the email, so I can safely assume that the email is not what's messing up the indentation. You say for line in f1: and then say s = line.strip() why not just for s in f1: s = s.strip() or the same thing with 'line'. You can say if s in ("",".block",".report"): continue elif s == ".endblock": And s2 = s2[:-1] + s can be written as s2 = s2+s beyond that I can't say because the indentation is not there. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor