def correct(x, file): if x == 'Delete': proceed = 'yes' while proceed == 'yes': count = 1 deletingitem = input('Which Item do you want to Delete? ') deletingitem = deletingitem - 1 print 'Ok, deleting the following item: ' print file[deletingitem] checkb4delete = input('Are you sure you want to delete that? ') if checkb4delete == 'yes': file.pop(deletingitem) for items in file: print count, items count = count + 1 proceed = input('Want to delete more items? ') #correctingitem = input('Which Ingredient? ') count = 1 for items in file: print count, items count = count + 1 if x == 'Edit': proceed = 'yes' removelist = saveremovelist.open_remove_list_memory() addtoremovelist = [] count = 1 for items in file: print count, items count = count + 1 while proceed == 'yes': editingitem = input('Which Item do you want to Edit? ') editingitem = editingitem - 1 print 'Ok, editing the following item: ' print file[editingitem] editeditem = input('What are you changing the item to? ') print 'Ok, editing from "', file[editingitem], '" to "', editeditem, '"' checkifaddtomemory = input('Do you want to add this edit to your removelist? :') if checkifaddtomemory == 'yes': payload = diff(editeditem, file[editingitem]) addtoremovelist.append(payload) for items in addtoremovelist: if items not in removelist: saveremovelist.add_to_remove_list_memory(items) addtoremovelist = [] checkb4edit = input('Are you sure you want to change this? ') if checkb4edit == 'yes': file[editingitem] = editeditem count = 1 for items in file: print count, items count = count + 1 proceed = input('Do you want to edit more items? ') #correctingitem = input('Which Ingredient? ') count = 1 for items in file: print count, items count = count + 1
def get_title_strip_ingredients(x): a = getingredients(x) #get raw ingredients title = a[0] #save title removelist = saveremovelist.open_remove_list_memory() onlyingredients = removestuff(removelist, a[1]) #remove crap from ingredients string = str(onlyingredients) string = string.replace(']', '') string = string.replace('[', '') string = string.replace("'", '') string = string.split(',') ingredientlist = [] #create blank list to add ingredients after cleaning for items in string: #run for loop to... if items != ' ': if items != '': a = items.strip() #strip starting and ending spaces ingredientlist.append(a) #append cleaned items to ingriedentlist lowercaseingredients = [] for items in ingredientlist: lowercaseingredients.append(items.lower()) titleandingredients = {} #creates blank dict for title and ing. titleandingredients[title] = lowercaseingredients #adds title and ingred. to dict return titleandingredients #returns title and list of ingredients