Skip to content

Latest commit

 

History

History
33 lines (27 loc) · 1.28 KB

README.md

File metadata and controls

33 lines (27 loc) · 1.28 KB

Python-JSON-SaveData

This python module helps you easily create save data for your python app or game! It only requires a few function calls to work, and uses default python modules, so no need to install any other modules. There is no need to credit me but it would be appreciated.

GitHub Downloads (all assets, all releases) GitHub Release

QuickStart Guide

  1. To start you must download save_data.py here.
  2. This is an example of the usage:
from save_data import *

if __name__ == "__main__":
    # Create a dictionary to contain the save data.
    save_file_data = {
        "user_info": {
            "username": "guest user"
        },
        "wins": 0,
        "loses": 0
    }

    # Create a savefile. If the file doesn't already exist then it creates it.
    save_file = SaveFile("test.json")

    save_file.write(save_file_data)
    print(save_file.read())

    # Modify save data to ensure it is writing the file properly
    save_file_data["wins"] = 1
    save_file.write(save_file_data)
    print(save_file.read())