-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuildmapping.py
44 lines (32 loc) · 906 Bytes
/
buildmapping.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
from what2eat.utils import read_xls,tobytes
def get_input():
dic = {"c": "Costco",
"w": "Wenhua",
"s": "Sentry"}
while True:
ret = raw_input("Which store (Costco/Wenhua/Sentry)?")
if not ret in ("c", "w", "s"):
continue
else:
return dic[ret]
def get_my_items():
table = read_xls("./menu.xlsx")
myitems = set()
for row in table:
items = tobytes(row[u'Ingredients']).split('|')
for myitem in items:
myitems.add(myitem)
return myitems
# f_map = open("item-map.txt", "w")
def main():
myitems = get_my_items()
f = open("item-map.txt", "w")
for myitem in myitems:
print myitem
store = get_input()
line = ",".join([myitem, store]) + '\n'
print line,
f.write(line)
f.flush()
if __name__ == '__main__':
main()