Return root to specific leaf from a nested dictionary tree
问题 The nested dictionary tree is of the form, categories = [{ 'name': 'Cat1', 'children': [{ 'name': 'SubCat1', 'children': [{ 'name': 'SubSubCat1', 'children': [] }] }] }, { 'name': 'Cat2', 'children': [] }] The recursive function should return the path from root to a specific leaf. Lets say, function(categories, 'SubCat1') should return a list containing ['Cat1', 'SubCat1'] . Likewise for function(categories, 'Cat2') should return the ['Cat2'] . Progress made so far def recurse_category