We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 514dd06 commit e2efe55Copy full SHA for e2efe55
app/settings/read_write_settings.py
@@ -1,5 +1,18 @@
1
-def read_settings(item):
2
- ...
+import json
3
4
5
+def read_settings(val):
+ with open('settings.json', 'r') as f:
+ data = json.load(f)
6
+ print(data[val])
7
+
8
+def write_settings(item, val):
9
10
11
12
+ data[item] = val
13
14
+ with open('settings.json', 'w') as f:
15
+ json.dump(data, f, indent=4)
16
17
+read_settings("timezone")
18
+write_settings("update_interval", 5)
app/settings/settings.json
@@ -1,4 +1,4 @@
{
- "update_interval": 5,
- "timezone": ""
+ "update_interval": 5,
+ "timezone": "America/New_York"
}
0 commit comments