-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path0070_recipes.py
31 lines (26 loc) · 906 Bytes
/
0070_recipes.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
import shelve
# blt = ['bacon', 'lettuce', 'tomato', 'bread']
# beans_on_toast = ['beans', 'bread']
# scrambled_eggs = ['eggs', 'butter', 'milk']
soup = ['tin of soup']
# pasta = ['pasta', 'cheese']
with shelve.open('./data/recipes', writeback=True) as recipes:
# recipes['blt'] = blt
# recipes['beans on toast'] = beans_on_toast
# recipes['scrambled eggs'] = scrambled_eggs
# recipes['pasta'] = pasta
# recipes['soup'] = soup
# recipes['blt'].append('butter')
# recipes['pasta'].append('tomato')
# temp_list = recipes['blt']
# temp_list.append('butter')
# recipes['blt'] = temp_list
# temp_list = recipes['pasta']
# temp_list.append('tomato')
# recipes['pasta'] = temp_list
# recipes['soup'].append('croutons')
recipes['soup'] = soup
recipes.sync()
soup.append('cream')
for snack in recipes:
print(snack, recipes[snack])