Dict with json file saving / restoring support
Project description
Dict with json file saving / restoring support
datetime, date support
readable formated json
safely file write with file move os function
auto-save support
compression support
Install
pip install jsondict
Usage
>>> from datetime import datetime
>>> from jsondict import JsonDict
>>> db = JsonDict('var/test.json')
>>> db.clear()
>>> db.update({'b': 2, 'created': datetime(2013, 1, 27, 21, 14), 'a': 1})
>>> db.save()
>>> open(db.filename).read()
'{\n "a": 1,\n "b": 2,\n "created": "2013-01-27T21:14:00Z"\n}'
Auto-save and compression
>>> import gzip
>>> db = JsonDict('var/test.json.gz', compress=True, autosave=True)
>>> db.clear()
>>> db['x'] = 'y'
>>> gzip.open(db.filename).read()
'{\n "x": "y"\n}'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
jsondict-1.2.tar.gz
(2.5 kB
view details)
File details
Details for the file jsondict-1.2.tar.gz.
File metadata
- Download URL: jsondict-1.2.tar.gz
- Upload date:
- Size: 2.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
155dd446fce1d7df25770cd6e5e1cf04322956e0840819675cc8c2a790853802
|
|
| MD5 |
0f87b847a4eedcaad08794ae908b8271
|
|
| BLAKE2b-256 |
a31a2e33745454b06f21f9dfb9c575a2b92c1750d682316bb5607cc1cf7e92c7
|