Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

save a dict to pickle

import pickle

a = {'hello': 'world'}

with open('filename.pickle', 'wb') as handle:
    pickle.dump(a, handle, protocol=pickle.HIGHEST_PROTOCOL)

with open('filename.pickle', 'rb') as handle:
    b = pickle.load(handle)
Comment

PREVIOUS NEXT
Code Example
Python :: pygame boilerplate 
Python :: create gui applications with python & qt5 (pyqt5 edition) pdf 
Python :: how to install matplotlib in python 
Python :: matplotlib dark mode 
Python :: display maximum columns pandas 
Python :: how to iterate through files in a folder python 
Python :: legend size matplotlib 
Python :: how to convert a column to datetime in pandas 
Python :: conda requests 
Python :: python clamp 
Python :: '.join([chr((ord(flag[i]) << 8) + ord(flag[i + 1])) for i in range(0, len(flag), 2)]) 
Python :: play video in google colab 
Python :: python get location of script 
Python :: show full pd dataframe 
Python :: The following packages have unmet dependencies: libnode72 : Conflicts: nodejs-legacy E: Broken packages 
Python :: get stats from list 
Python :: keras plot history 
Python :: NAN values count python 
Python :: split data validation 
Python :: pandas remove timezone info 
Python :: how to install dask in python 
Python :: matplotlib bar chart from dictionary 
Python :: python rotate screen 
Python :: export image png python 
Python :: divide by zero error python exception handling 
Python :: min max scaler sklearn 
Python :: python get day name 
Python :: jalali date to gregorian date 
Python :: pytorch check gpu 
Python :: get_object_or_404 django 
ADD CONTENT
Topic
Content
Source link
Name
7+5 =