-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathcheese.py
More file actions
executable file
·36 lines (27 loc) · 763 Bytes
/
cheese.py
File metadata and controls
executable file
·36 lines (27 loc) · 763 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import os
import json
def read_cheese_preferences():
full_path = os.path.expanduser("~/.cheese.json")
with open(full_path, "r") as f:
prefs = json.load(f)
return prefs
def write_cheese_preferences(prefs):
full_path = os.path.expanduser("~/.cheese.json")
with open(full_path, "w") as f:
json.dump(prefs, f, indent=4)
def write_default_cheese_preferences():
write_cheese_preferences(_default_prefs)
_default_prefs = {
"slicing": ["manchego", "sharp cheddar"],
"spreadable": [
"Saint Andre",
"camembert",
"bucheron",
"goat",
"humbolt fog",
"cambozola",
],
"salads": ["crumbled feta"],
}
if __name__ == "__main__":
write_default_cheese_preferences()