使用集合/列表作为值的字典反转
我编写了一个函数来反转字典(已对许多其他类似任务的StackExchange帖子进行了检查),该字典的键是字符串,值是(字符串)集合:
def invert_dict(d: Dict[str, set]) -> Dict[str, set]:
"""
Returns inverted dictionary (with original dictionary, d, whose keys are
strings and values are sets containing string...