Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python save dictionary

import pickle

def Save():
    with open("Data.txt", "wb") as pkl_handle:
        pickle.dump(dictionary_data, pkl_handle)

# LOAD
def Load():
    with open("Data.txt", "rb") as pkl_handle:
        output = pickle.load(pkl_handle)
        return output

def Add_Value(Name, Amount):
    dictionary_data[Name] = Amount
    Save()

dictionary_data = Load()

Add_Value('Name', 'Value')

print(dictionary_data)
 
PREVIOUS NEXT
Tagged: #python #save #dictionary
ADD COMMENT
Topic
Name
2+5 =