python - a simple command -- "np.save", maybe i misunderstood -


just working through example numpy.save -- http://docs.scipy.org/doc/numpy/reference/generated/numpy.save.html

examples

from tempfile import temporaryfile  outfile = temporaryfile()  x = np.arange(10)  np.save(outfile, x) 

after command (highlighted), why not find output file called "outfile" in current directory? sorry may sound stupid

outfile.seek(0) # needed here simulate closing & reopening file  np.load(outfile)  array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) 

it because using - temporaryfile , temporary file not stored outfile in directory.

if want save outfile , can give name , save file.

np.save('outfile',x) 

when saving load, need use , again filename string -

np.load('outfile') 

Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -