Fixed json write
This commit is contained in:
17
test2.py
17
test2.py
@@ -1,17 +0,0 @@
|
||||
import json
|
||||
|
||||
|
||||
def write_json(guild: int, param_name: str, param: str or int):
|
||||
with open('prefix.json', 'r', 'utf-8') as _f:
|
||||
try:
|
||||
_json = json.load(_f)
|
||||
except json.decoder.JSONDecodeError:
|
||||
_json = {}
|
||||
_json.update({f'{guild}': {}})
|
||||
print(_json)
|
||||
_guild = _json[f'{guild}']
|
||||
print(_guild)
|
||||
_guild.update({f'{param_name}': f'{param}'})
|
||||
print(_json)
|
||||
|
||||
write_json(929446191270330452, 'test1', '34')
|
||||
Reference in New Issue
Block a user