A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/085342.html below:

How to store numeric array in disk

How to store numeric array in disk How to store numeric array in diskJanko Hauser jhauser at ifm.uni-kiel.de
Fri Apr 27 06:03:11 EDT 2001
"Tawee Laoitichote" <astpspd at pea.or.th> writes:

> py> myfile='h:\\python21\\prob.pik'
> py> print myfile
> h:\python21\prob.pik
> py> p=pickle.Pickler(myfile)
> Traceback (most recent call last):
>   File "<pyshell#61>", line 1, in ?
>     p=pickle.Pickler(myfile)
>   File "h:\python21\lib\pickle.py", line 104, in __init__
>     self.write = file.write
> AttributeError: write
> 
> my next statement should be p.dump(mystuff) #which is my array stuff
> 
> What am I doing wrong? Please suggest...
> 

myfile should be an opened file object like

py> myfile=open('h:\\python21\\prob.pik','rb')

Are you using the standard array or arrays from the NumPy package?
If mystuff are NumPy arrays there are special functions to pickle
these to disk, like DumpArray or LoadArray.

HTH,
__Janko
-- 
  Institut fuer Meereskunde             phone: 49-431-597 3989
  Dept. Theoretical Oceanography        fax  : 49-431-565876
  Duesternbrooker Weg 20                email: jhauser at ifm.uni-kiel.de
  24105 Kiel, Germany

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4