mirror of
https://github.com/python/cpython.git
synced 2025-09-24 09:23:02 +00:00
Add some spaces in the example code.
This commit is contained in:
parent
7eec217908
commit
03b75fa4e1
1 changed files with 3 additions and 3 deletions
|
@ -799,7 +799,7 @@ class TextReader:
|
||||||
del odict['fh'] # remove filehandle entry
|
del odict['fh'] # remove filehandle entry
|
||||||
return odict
|
return odict
|
||||||
|
|
||||||
def __setstate__(self,dict):
|
def __setstate__(self, dict):
|
||||||
fh = open(dict['file']) # reopen file
|
fh = open(dict['file']) # reopen file
|
||||||
count = dict['lineno'] # read from file...
|
count = dict['lineno'] # read from file...
|
||||||
while count: # until line count is restored
|
while count: # until line count is restored
|
||||||
|
@ -820,7 +820,7 @@ A sample usage might be something like this:
|
||||||
... obj.readline()
|
... obj.readline()
|
||||||
'7: class TextReader:'
|
'7: class TextReader:'
|
||||||
>>> import pickle
|
>>> import pickle
|
||||||
>>> pickle.dump(obj,open('save.p','w'))
|
>>> pickle.dump(obj,open('save.p', 'wb'))
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
||||||
If you want to see that \refmodule{pickle} works across Python
|
If you want to see that \refmodule{pickle} works across Python
|
||||||
|
@ -829,7 +829,7 @@ follows can happen from either the same process or a new process.
|
||||||
|
|
||||||
\begin{verbatim}
|
\begin{verbatim}
|
||||||
>>> import pickle
|
>>> import pickle
|
||||||
>>> reader = pickle.load(open('save.p'))
|
>>> reader = pickle.load(open('save.p', 'rb'))
|
||||||
>>> reader.readline()
|
>>> reader.readline()
|
||||||
'8: "Print and number lines in a text file."'
|
'8: "Print and number lines in a text file."'
|
||||||
\end{verbatim}
|
\end{verbatim}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue