A simple config parser that supports JSON and YAML
Project description
A simple Config file parser that supports json, and yaml formats with auto-save feature.
Usage
Example -
import trabConfig
# load file verbatim
config = trabConfig("config.json", autosave=False, data='json')
# or just
config = trabConfig("config.json")
# for yaml
config = trabConfig("config.yml", data='yaml)
# autosave capability (saves on changes)
config.autosave = True
# or during instantiation
config = trabConfig("config.json", autosave=True)
# usage example
health = config['health']
config['health'] = 9999
mana = config.get('mana', None)
if mana is not None:
config['mana'] = 999
lvl = config.get('lvl')
config.set('lvl', 99)
config.new('items', [])
config['items'].append('gold')
config.delete('cloth')
config.save()
Notes
Created by - traBpUkciP 2016-2017
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
trabConfig-0.1.2.tar.gz
(2.9 kB
view hashes)
Built Distributions
Close
Hashes for trabConfig-0.1.2-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef2c9b77c38eaf5eeb3961be1f9d747c0abe6a1940a436f08d8e357cfca8e443 |
|
MD5 | 798e26dfa8735e809733592e215371ef |
|
BLAKE2b-256 | 30fbb4b9caf1888a7d3239205899ebf5f0cc483e35773ba205d6d9ee95845fa6 |
Close
Hashes for trabConfig-0.1.2-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdad3bd64a1e6b46a6fc3cd21514d8f4d51632a385173b36e6d669b77e208a84 |
|
MD5 | 5246be418413816186a00e7c33e95ebc |
|
BLAKE2b-256 | 27eba3370d6d323a2bdc347c0c1105dad3ebef60a7e0bb32e263607e3e2a85e7 |