Is there an alternative to pickle - save a dictionary (python)

前端 未结 3 1926
一生所求
一生所求 2021-01-14 04:04

I need to save a dictionary to a file, In the dictionary there are strings, integers, and dictionarys.

I did it by my own and it\'s not pretty and n

3条回答
  •  耶瑟儿~
    2021-01-14 04:37

    JSON is not quite Python-way because of several reasons:

    1. It can't wrap/unwrap all Python data types: there's no support for sets or tuples.
    2. Not fast enough because it needs to deal with textual data and encodings.

    Try to use sPickle instead.

提交回复
热议问题