pickle.dumps(obj[,protocol])¶
Return the pickled representation of the object as a string, instead of writing it to a file.
If the protocol parameter is omitted, protocol 0 is used. If protocol is specified as a negative value orHIGHEST_PROTOCOL, the highest protocol version will be used.
Changed in version 2.3: The protocol parameter was added.
protocol参数说明 默认为0,负数或HIGHEST_PROTOCOL使用 highest protocol
Return the pickled representation of the object as a string, instead of writing it to a file.
If the protocol parameter is omitted, protocol 0 is used. If protocol is specified as a negative value orHIGHEST_PROTOCOL, the highest protocol version will be used.
Changed in version 2.3: The protocol parameter was added.
protocol参数说明 默认为0,负数或HIGHEST_PROTOCOL使用 highest protocol
本文介绍了 Python 中 pickle 模块的 dumps 方法,详细解释了如何将对象转换为字符串形式的 pickled 表示。该方法支持不同的协议选项,包括默认协议 0、最高协议 HIGHEST_PROTOCOL 以及负数协议。
11万+

被折叠的 条评论
为什么被折叠?



