mirror of
https://github.com/RGBCube/JsonWrapper
synced 2025-07-27 11:47:45 +00:00
Update set.py
This commit is contained in:
parent
7c20335573
commit
c5a2c5de55
1 changed files with 21 additions and 3 deletions
|
@ -1,5 +1,23 @@
|
||||||
from json_wrapper import JsonWrapper
|
from json_wrapper import JsonWrapper # Initialization
|
||||||
|
|
||||||
db = JsonWrapper("example.json")
|
db = JsonWrapper("example.json") # Initialization
|
||||||
|
|
||||||
db.set("a", ["valu
|
|
||||||
|
# set normal
|
||||||
|
db.set("a", 123)
|
||||||
|
|
||||||
|
data = db.all()
|
||||||
|
|
||||||
|
print(data) # {'a': 123}
|
||||||
|
|
||||||
|
db.nuke()
|
||||||
|
|
||||||
|
|
||||||
|
# set pathmagic
|
||||||
|
db.set("a", 123, pathmagic="example+path")
|
||||||
|
|
||||||
|
data = db.all()
|
||||||
|
|
||||||
|
print(data) # 'example': {'path': {'a': 123}}}
|
||||||
|
|
||||||
|
db.nuke()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue