alank_ok
alank_ok

Reputation: 13

Python: is it possible to set a high score without a text file?

I have recently made a game with python that makes the user decipher an anagram and based on difficulty it increases their score. Is there any way to implement a high score into this without the use of a text file? The overall goal is for the program to compare the users score to the high score and if the score is greater it would edit the high score to the score gained. This would need to stay like that for the next run through of the program after I close it.

Upvotes: 1

Views: 68

Answers (2)

Kotauskas
Kotauskas

Reputation: 1374

Don't forget: there's always HKCU and winreg module from stdlib. It can be useful. It's well documented.

Upvotes: 0

hspandher
hspandher

Reputation: 16743

At the end of the day, you need to store the score in one type of database or the other, whether it's a file-based database or relational or any other. For one execution of your code, you can certainly keep it in the RAM, but for persistence, there's no way around it. If your use case is simple, you may consider sqlite instead of explicit file-based storage.

Upvotes: 3

Related Questions