[Python] Is there a way to make Python generate a hash of certain data and then use the hash...

Discussão em 'Python' iniciado por Stack, Abril 18, 2025.

  1. Stack

    Stack Membro Participativo

    I'm creating a text-based fishing game, and I'd like to include a feature in the script to save/load player data. For context, here's the data I'd like the user to be able to save/load:

    experience_points = 0
    fishing_count = 0
    fisherman_level = []
    player_equipment = []
    employees = []


    fisherman_level is a list that contains only int type items. However, player_equipment and employees are both lists that contain only str type items.

    As for the saving mechanism, I'm interested in having Python take the above variables and their respective values and then generate some kind of hash based on the data. Once the player launches the script again, they can input the hash and have the script reload their data. I'm interested in this specific saving mechanism, because I don't want to have this script take up system resources by storing a save file on the player's machine. I was thinking to have the save/load mechanism be included in the script as functions that the player could call through a text menu.

    I'm new to Python, and I'm still learning a lot about this language. I only started learning Python last month, so I have no idea how I to go about this. All responses will be much appreciated!

    P.S. If you'd like to look over the code for my game, here it is: https://github.com/John-Michael-D/Chapter-4-Projects/blob/main/2 - Fishing Game WIP 4.py

    Continue reading...

Compartilhe esta Página