Closing A File After Using Np.load (using Spyder)
I am loading a file: a= np.load('myfile.npz') and then doing things with a After a while I regenerate myfile.npz (on a remote machine). When I attempt to copy the file across (usi
Solution 1:
Try using the with
context manager:
with np.load('myfile.npz') as a:
do_stuff(a)
do_morestuff() # a is closed now
Context managers automatically take care of closing the resource once you are done with it.
Post a Comment for "Closing A File After Using Np.load (using Spyder)"