I need to make a high scores list to a game, for class, and it has to be stored using a pickled object. I can only get it to where it stores and prints one score, and then every time you play it the score gets overwritten. How can I append and sort it.
Here's the code I have so far:
import cPickle, shelve player_score=[name, score] high_scores=open("high_scores.dat", "w") cPickle.dump(player_score, high_scores) high_scores.close high_scores=open("high_scores.dat", "r") player_score=cPickle.load(high_scores) print Player_score high_scores.close