How to store numeric array in disk

Alex Martelli aleaxit at yahoo.com
Fri Apr 27 05:33:12 EDT 2001


"Tawee Laoitichote" <astpspd at pea.or.th> wrote in message
news:mailman.988361105.31325.python-list at python.org...
> Dear,
>
> I'd like to keep my array stuff in my hard disk after a number of
> experiments. I hear of pickling and unpickling. I have tried but some
> errors. Like this :
>
> py> myfile='h:\\python21\\prob.pik'
> py> print myfile
> h:\python21\prob.pik
> py> p=pickle.Pickler(myfile)

Change this last statement to
    p = pickle.Pickler( open(myfile, "w") )

as Pickler takes a file-object, not a string.

The relevant example, part of the Numeric tutorial at
http://starship.python.net/~da/numtut/array.html, is
specifically at URL
http://starship.python.net/~da/numtut/array.html#SEC51.


Alex






More information about the Python-list mailing list