Re:  pickle: Tried to look into how to use this - looks like it
involves opening/closing files...? and dumping? and usr bins? ha ha.
LOST.  This might have to be another thread!

Pickle is simple enough.

#################

import pickle

filename = "myfile.txt"    ## Change this with an appropriate filename

f1 = open(filename,"w")
highScoreList = [(200,"Jacob"),(175,"Diane"),(100,"Gary")] ## This is your highscore list


pickle.dump(f1,highScoreList)

f1.close()

##################

and then to retrieve the list, even after the program closes

##################

import pickle

filename = "myfile.txt"   # This has to be the same filename as before

f1 = open(filename,"r")
highScoreList = pickle.load(f1)

f1.close()
#####################

HTH,
Jacob


_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to