-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoptions.py
47 lines (36 loc) · 890 Bytes
/
options.py
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
37
38
39
40
41
42
43
44
45
46
OBJECT = {
'foo': {
'tRGET': 123,
'other': 456
},
'bar': {
'selected baz': 245,
'select test': ''
}
}
AWNSER = {
"selectedItem": 'foo',
"action": 'view'
}
def select_key(selected, obj):
user = input("enter a key: ")
if user in selected:
selected.remove(user)
else:
selected.append(user)
selected = []
current_obj = OBJECT
while isinstance(current_obj, dict):
for key in current_obj:
if key in selected:
print("selected: ", key)
else:
print(key)
action = input('what do you want to do: ')
if action == "select":
select_key(selected, current_obj)
elif action == "view":
current_obj = current_obj[selected[0]]
# while isinstance(current_obj, dict):
# current_obj = select_key(current_obj)
# print(current_obj)