Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

save and load a dictionary python

import pickle
dictionary_data = {"a": 1, "b": 2}
a_file = open("data.pkl", "wb")
pickle.dump(dictionary_data, a_file)
a_file.close()
a_file = open("data.pkl", "rb")
output = pickle.load(a_file)
print(output)
a_file.close()
Comment

save python dic

import pickledict = {'Python' : '.py', 'C++' : '.cpp', 'Java' : '.java'}f = open("file.pkl","wb")pickle.dump(dict,f)f.close()
Comment

PREVIOUS NEXT
Code Example
Python :: numpy annotate with three arrows 
Python :: dict from group pandas 
Python :: couple legend from twin axes python 
Python :: openpyxl _cells_by_row 
Python :: python pygeoip example 
Python :: python setup install_requires local whl 
Python :: github/hacksofteare 
Python :: mask and then fillnan# 
Python :: dynamic frame latest record 
Python :: dataframe remove first row 
Python :: if query empty print python 
Python :: if using and in python 
Python :: python pool 
Python :: download viper for python ubutunu 
Python :: tf get devices 
Python :: tf.slice 
Python :: download pyautogui 
Python :: sring to name variable pyton 
Python :: change password urls 
Python :: add_node python 
Python :: python type hint superclass 
Python :: first and last upper 
Python :: pattern 
Python :: python x,y,z is d (20, 30, False) 
Python :: repetition of word in python 
Python :: Raymenschechorne 
Python :: convert multidimentional numpy array to string and back 
Python :: the coding train 
Python :: python arithmetic operation with list 
Python :: check processing bar of loop in python 
ADD CONTENT
Topic
Content
Source link
Name
5+6 =