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

前端 未结 3 1967
一生所求
一生所求 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:36

    Presuming your dictionary contains only basic data types, the normal answer is json, it's a popular, well defined language for this kind of thing.

    If your dictionary contains more complex data, you will have to manually serialise it at least part of the way.

提交回复
热议问题