On Dec 3, 2005, at 9:40 PM, david wrote:

sorry i forgot a subject line. i have looked at the pickle module and was able to pickle world.
but i can't figure how to restore everything.

import pickle

def save_game(state, filename):
    file = open(filename, 'w')
    pickle.dump(state, file)
    file.close()

def load_game(filename):
    file = open(filename, 'r')
    state = pickle.load(file)
    file.close()
    return state

save_game(world, 'mygame')

world = load_game('mygame')

-- 
logic (n.): the art of being wrong with confidence.



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

Reply via email to