On 12/08/12 03:43, Richard D. Moores wrote:
=========== if "factors.dat":
This is testing if the string is True, which it always is. I assume you intended something like if os.path.exists('factors.dat'):
f = open("factors.dat", 'rb') data = pickle.load(f) f.close D = data else: f = open("factors.dat", 'wb')
Not sure there is any point in opening a new file at this point. you are trying to populate data, but if there's no file there is no data so instead of opening the file you want something like data = {}
-- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor