美文网首页
python进阶--哪些python对象可以pickle序列化

python进阶--哪些python对象可以pickle序列化

作者: DATA_KENGOU | 来源:发表于2019-08-09 11:11 被阅读0次

    What can be pickled and unpickled?

    The following types can be pickled:
    可以被序列化的类型有:

    • None, True, and False

    • integers, floating point numbers, complex numbers,整型、浮点型、复数

    • strings, bytes, bytearrays,字符串、比特类型、比特数组

    • tuples, lists, sets, and dictionaries containing only picklable objects,元组、列表、集合、字典,它们里面包含的内容也必须可以pickle

    • functions defined at the top level of a module (using def, not lambda)

    • built-in functions defined at the top level of a module

    • classes that are defined at the top level of a module

    • instances of such classes whose __dict__ or the result of calling __getstate__() is picklable (see section Pickling Class Instances for details).

    相关文章

      网友评论

          本文标题:python进阶--哪些python对象可以pickle序列化

          本文链接:https://www.haomeiwen.com/subject/qdpcjctx.html