Nov-06-2019, 09:49 PM
Given the current dict and data structure, doing a search for chicken pulls all recipes for chicken. If I wanted to refine that search for bourbon chicken, how would I go about digging deeper to get that key? Or should the data storage be different. I've been looking into json a little.
Thanks
Current scenario
Thanks
Current scenario
recipes = { "chicken":[ {"bourbon":[ {"ingedients":"burbon, chicken, stove, pan","directions":"cook it and eat it"} ]}, {"fried":[ {"ingredients":"grease, chicken, seasonings","directions":"fry chicken and put seasons on it then eat"} ]} ], "beef":[ {"hamburger":[ {"ingredients":"1 pound of ground beef, forman grill, salt and pepper","directions":"you know the drill"} ]}, {"spagetti":[ {"ingredients":"noodles, sauce, hamburger","directions":"cook the stuff and pig out"} ] } ] } print(type(recipes)) x = 'chicken' if x in recipes: print(recipes[x])