mirror of https://github.com/python/cpython
dumps() and loads() work in terms of bytes objects not strings.
This commit is contained in:
parent
e57950fbfe
commit
b9e2304c44
|
@ -194,18 +194,18 @@ process more convenient:
|
||||||
|
|
||||||
.. function:: dumps(obj[, protocol])
|
.. function:: dumps(obj[, protocol])
|
||||||
|
|
||||||
Return the pickled representation of the object as a string, instead of writing
|
Return the pickled representation of the object as a :class:`bytes`
|
||||||
it to a file.
|
object, instead of writing it to a file.
|
||||||
|
|
||||||
If the *protocol* parameter is omitted, protocol 3 is used. If *protocol*
|
If the *protocol* parameter is omitted, protocol 3 is used. If *protocol*
|
||||||
is specified as a negative value or :const:`HIGHEST_PROTOCOL`, the highest
|
is specified as a negative value or :const:`HIGHEST_PROTOCOL`, the highest
|
||||||
protocol version will be used.
|
protocol version will be used.
|
||||||
|
|
||||||
|
|
||||||
.. function:: loads(string)
|
.. function:: loads(bytes_object)
|
||||||
|
|
||||||
Read a pickled object hierarchy from a string. Characters in the string past
|
Read a pickled object hierarchy from a :class:`bytes` object.
|
||||||
the pickled object's representation are ignored.
|
Bytes past the pickled object's representation are ignored.
|
||||||
|
|
||||||
The :mod:`pickle` module also defines three exceptions:
|
The :mod:`pickle` module also defines three exceptions:
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue