[ Web Proxy ]
URL:
Viewing: https://mofanpy.com/tutorials/python-basic/basic/pickle [Back]  [Original]

pickle | Python pickle [pickle ]

x AI


pickle

: : : 2016-01-01

:

pickle

pickle python , // . . . .

import pickle a_dict = {'da': 111, 2: [23,1,4], '23': {1:2,'d':'sad'}} # pickle a variable to a file file = open('pickle_example.pickle', 'wb') pickle.dump(a_dict, file) file.close()

wb 'pickleexample.pickle' , pickle.dump file. file 'pickleexample.pickle' , .

pickle

, , load python .

# reload a file to a variable with open('pickle_example.pickle', 'rb') as file: a_dict1 =pickle.load(file) print(a_dict1)

:

""

wechat [wechat]
    []

    Python

    :



    Email: mofanpy@hotmail.com

    © 2022 mofanpy.com All Rights Reserved ICP20060366


    Web Proxy Viewer  |  New URL  |  Original Page