"Sara Johnson" <[EMAIL PROTECTED]> wrote > Sorry...I forgot a few more lines at the end of the code. Starts > with "outfile2write..." > I also added outfile2.sort()
OK, at leasrt we see where the error occcurs. The problem emains that you are trying to sort a file which doesn't have a sort method. You need to sort the data before saving it. Alan G. ================ outfile2=open('missmeas.dat','w') for key in skeys: fracmiss=1.*numberMissing(z[key].values())/nsites outstring="%s has %4.1f%% missing" % (key,100*fracmiss) if fracmiss>0.: print outstring outfile2.write(outstring+'\n') #notice explicit newline \n outfile2.sort() outfile2.close() _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor