【发布时间】:2022-01-18 20:46:42
【问题描述】:
我有一本像下面这样的字典:
{'weather1': {428: 68253},
'weather2': {1323: 68586, 1343: 68605, 1344: 68606},
'weather3': {311: 68183, 312: 68184, 290: 68164},
'weather4': {699: 68304, 721: 68323, 722: 68324},
'weather5': {7260: 69942},
'weather6': {15: 68095, 35: 68114, 36: 68115})
我想删除只有一个值的键。比如我想删除weather1和weather5,把字典的其余部分恢复成字典格式
有什么想法吗?
【问题讨论】:
标签: python python-3.x dictionary