Hi Everyone,
Just new here, I'm doing an exercise about dictionary and pickle. I have this code which i use
to capture new data information
create empty dictionary everytime i run this function? will it override the existing lothold
dictionary or it will create another lothold dictionary? meaning, if I call this function 3x
I will have 3 lothold dictionary...i don't want that to happen, i only want to keep one for
updating so on...
Thank you in advance :)
-jjpy
Just new here, I'm doing an exercise about dictionary and pickle. I have this code which i use
to capture new data information
def data_entry(in_file): # create an empty dictionary lothold = {} # define key, value pair lothold["Date"] = input("Date:") lothold["Product"] = input("Product:") lothold["LotID"] = input("Lot ID:") # dump the file using the pickle dump method pickle.dump(lothold, in_file)My question is, I've open a file in "ab" mode (append/binary) mode. what will happen to the
create empty dictionary everytime i run this function? will it override the existing lothold
dictionary or it will create another lothold dictionary? meaning, if I call this function 3x
I will have 3 lothold dictionary...i don't want that to happen, i only want to keep one for
updating so on...
Thank you in advance :)
-jjpy