ReadSettings For Python

Easily create, edit and remove a customized settings file which you can use for storing all of the settings for your application. At the moment, ReadSettings is compatible with Python 3 but support to more programming langauages may come in the future.

Installation

You can install ReadSettings for Python with pip.

pip install readsettings
        

Usage

Importing

Here is some example code to setup the settings.

from readsettings import ReadSettings
settings = ReadSettings("mysettings.json")
        

Create or change of a setting

This function creates or changes a setting.

settings.set("name", "contents")
        

Get the value of a setting

This function returns the value of a setting.

settings.get("name")
        

Rename a setting

This function renames a setting.

settings.ren("name", "newname")
        

Create or reset a settings file

When importing, the settings file is automatically created. However, you can still use this function create or reset a settings file.

settings.clear()
        

Change target settings file

You can use this function to change the settings file used. You can also set a boolean to also copy the old settings to the new file.

settings.change("newsettings.json", True)
        

Get the raw JSON

This function returns the raw JSON of the settings file.

settings.raw()