[Python-checkins] r55705 - python/trunk/Doc/lib/libpickle.tex
neal.norwitz
python-checkins at python.org
Thu May 31 06:14:29 CEST 2007
Author: neal.norwitz
Date: Thu May 31 06:14:22 2007
New Revision: 55705
Modified:
python/trunk/Doc/lib/libpickle.tex
Log:
Add some spaces in the example code.
Modified: python/trunk/Doc/lib/libpickle.tex
==============================================================================
--- python/trunk/Doc/lib/libpickle.tex (original)
+++ python/trunk/Doc/lib/libpickle.tex Thu May 31 06:14:22 2007
@@ -799,7 +799,7 @@
del odict['fh'] # remove filehandle entry
return odict
- def __setstate__(self,dict):
+ def __setstate__(self, dict):
fh = open(dict['file']) # reopen file
count = dict['lineno'] # read from file...
while count: # until line count is restored
@@ -820,7 +820,7 @@
... obj.readline()
'7: class TextReader:'
>>> import pickle
->>> pickle.dump(obj,open('save.p','w'))
+>>> pickle.dump(obj,open('save.p', 'wb'))
\end{verbatim}
If you want to see that \refmodule{pickle} works across Python
@@ -829,7 +829,7 @@
\begin{verbatim}
>>> import pickle
->>> reader = pickle.load(open('save.p'))
+>>> reader = pickle.load(open('save.p', 'rb'))
>>> reader.readline()
'8: "Print and number lines in a text file."'
\end{verbatim}
More information about the Python-checkins
mailing list