[Tutor] Saving Data (fwd)

Lloyd Kvam pythontutor at venix.com
Wed Dec 31 14:04:43 EST 2003


http://www.python.org/doc/lib/node63.html
3.14.2 Data stream format

This specifies:
	0 ascii data
	1 binary data (but new style classes use a log of bytes)
	2 binary data (stores new style classes efficiently)

protocol replaces the old bin parameter which was true/false for binary.

protocol 2 is new in Python2.3 (I can't test that easily, but believe it is true.)

Danny Yoo wrote:

> 
> ---------- Forwarded message ----------
> Date: Wed, 31 Dec 2003 10:58:48 -0500 (EST)
> From: Vicki Stanfield <vicki at thepenguin.org>
> To: Danny Yoo <dyoo at hkn.eecs.berkeley.edu>
> Subject: Re: [Tutor] Saving Data
> 
> 
>>You may also find the 'shelve' module useful:
>>
>>    http://www.python.org/doc/lib/module-shelve.html
>>
>>Shelves act like dictionaries --- except that when we put things into
>>them, they actually store on disk!  So they should allow you to save the
>>state of your program so that you can restore it later.
> 
> 
> Do I need to change the protocol passed depending on whether I am working
> on a Windows machine or a Linux box? It appears not. Is there more
> information on this protocol variable? I have only found that it may be
> None, 1, 2, or 3 and that only None and 1 work. There seems to be a
> shortage of information on this option (in pickle or shelve descriptions).
> 
> --vicki
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
> 

-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice:	603-653-8139
fax:	801-459-9582




More information about the Tutor mailing list