##Import pickle module
import pickle
##Let's create example dic object
eample_dict = {'Sarbadal': ['Manager', '5 years', 'Data Science', 'Photography'],
'AJ': ['Lead', '4 years', 'Data Science', 'Video Game'],
'Shobhit': ['Sr. Analyst', '1 year', 'Data Science', 'Python'],
'Abhishek': ['Analyst', '2 years', 'Data Science', 'Painting']}
##Creating pickle
filename = r'F:\Python\Pickle Objects\pickle_example_dict'
file = open(filename, 'wb')
pickle.dump(eample_dict, file)
##Loading pickle
file = open(filename, 'rb')
new_dict = pickle.load(file)
##Checking the loaded object
print(type(new_dict))
print(new_dict['AJ'])
No comments:
Post a Comment