file handling using pickle
<p>try.py:</p>

<pre><code>import pickle

f=open('abc.dat','w')
x=[320,315,316]
y=pickle.load(f)
f.close()
f=open('abc.dat','w')
for i in x:
        y.append(i)
pickle.dump(y,f)
f.close()
</code></pre>

<p>use.py</p>

<pre><code>import pickle
import os

os.system('try.py')
f=open('abc.dat', 'r')
print "abc.dat = "
x=pickle.load(f)
print x
print "end of abc.dat"
f.close();
y=x[:]
for z in x:
        y.remove(z)
        print "removing " + str(z)
        print str(y) + " and " + str(x)
        f=open('abc.dat', 'w')
        pickle.dump(y, f)
        f.close()
</code></pre>

<p>error:</p>

<pre><code>Traceback (most recent call last):
  File "G:\parin\new start\use.py", line 7, in &lt;module&gt;
    x=pickle.load(f)
  File "C:\Python26\lib\pickle.py", line 1370, in load
    return Unpickler(file).load()
  File "C:\Python26\lib\pickle.py", line 858, in load
        dispatch[key](self)
  File "C:\Python26\lib\pickle.py", line 880, in load_eof
    raise EOFError
EOFError
</code></pre>
