Say I have these two lists:
top_levels = ["a", "b", "c"] sub_levels = ["d", "e", "f"] How do I create:
nested_dict = { "a": {"d": 0, "e": 0, "f": 0}, "b": {"d": 0, "e": 0, "f": 0}, "c": {"d": 0, "e": 0, "f": 0}, } https://stackoverflow.com/questions/66540621/create-nested-dictionary-in-python-dynamically March 09, 2021 at 12:00PM
没有评论:
发表评论