def loadFromFile(): filename = 'savedgames' if not os.path.isfile(filename): open(filename, 'w').close() f = LamecryptFile(filename, 'r') games = [] for strG in f.read().split("\n"): g = strG.split(':') if len(g) == 3: games.append( Game(g[0], int(g[1]), Sudoku.fromString(g[2])) ) return games
def loadFromFile(): filename = 'highscores' if not os.path.isfile(filename): open(filename, 'w').close() f = LamecryptFile(filename, 'r') highscores = [] for strHs in f.read().split("\n"): hs = strHs.split(':') if len(hs) == 3: highscores.append( HighScore(hs[0], int(hs[1]), hs[2]) ) return highscores