hi,<br>i am a beginner in python language,<br><br>i am trying with this programme :<br>to find the addition and mean from a data set in a file and writing the mean and sum in some other file :<br>""<br><b>#! /usr/bin/env python<br>
<br>import re<br>import cPickle as p<br>import math<br>from numpy import *<br><br>f0= open("temp9","r+").readlines()<br>f2= open("out1","r+")<br>add_1=[ ];<br>for i in range(0, len(f0)):<br>
        f1=f0[i].split()<br>        add= float(f1[1])+float(f1[2])<br>    mean= float(add)/2<br>        print (f1[1]).ljust(6) ,(f1[2]).ljust(6),repr(add).ljust(7), repr(mean).ljust(7)<br>        add_1.append(add)<br>    add_1.append(mean)<br>
        f2.write("%s" % repr(add).ljust(7)),f2.write("%s" % repr(mean).ljust(7))<br>print "printing from file"<br>for i in range(0, len(add_1),2):<br>        print add_1[i],"        ", add_1[i+1]<br>
<br>f0.close()<br>f2.close()</b><br><br><br>""<br><br>and this programme is givving me this error :<br><br>""    <b>Traceback (most recent call last):<br>  File "./temporary1.py", line 24, in <module><br>
    f0.close()<br>AttributeError: 'list' object has no attribute 'close'</b><br>""<br><br>please help to to find the error.<br>or suggest some simpler or better way<br><br>note:  <br>1)file "temp9" is already exist<br>
2)this programme is giving me all my outputs, but at the end of the out ..its giving me that error.<br>