I named it dict1, for example, but in fact I use a dictionary from the Internet, which I can’t rewrite initially.The values are set.
dict1 = {'cats':{'1','2'},
'dogs':{'1'}}
Output:
{'cats': {'1', '2'}, 'dogs': {'1'}}
I want the values to be an array, not a dictionary. Output i want:
{'cats': ['1', '2'], 'dogs': ['1']}
>Solution :
You can do:
dict2 = {k: list(v) for k, v in dict1.items()}