[{'config': [], 'video': ['create', 'list', 'AIreview', 'download', 'approve', 'modify', 'read'], 'channel': ['create', 'modify', 'read', 'list', 'delete', 'approve'], 'webpage': ['list'], 'organization': ['subsidiaries_list', 'channel_list', 'video_list'], 'account': ['list', 'modify_self', 'read_self'], 'catalog': []}
{'config': [], 'video': ['create', 'list', 'modify', 'read', 'delete', 'AIreview', 'download'], 'channel': ['create', 'modify', 'read', 'list', 'delete', 'approve'], 'webpage': ['list'], 'organization': ['subsidiaries_list', 'channel_list', 'video_list'], 'account': ['list', 'modify_self', 'read_self'], 'catalog': []}]
#!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
@author: YangPC
@time:2021/06/18
@QQ:327844761
@微信公众号:ewbang
"""
if __name__ == '__main__':
d = [{'config': [], 'video': ['create', 'list', 'AIreview', 'download', 'approve', 'modify', 'read'],
'channel': ['create', 'modify', 'read', 'list', 'delete', 'approve'], 'webpage': ['list'],
'organization': ['subsidiaries_list', 'channel_list', 'video_list'],
'account': ['list', 'modify_self', 'read_self'], 'catalog': []},
{'config': [], 'video': ['create', 'list', 'modify', 'read', 'delete', 'AIreview', 'download'],
'channel': ['create', 'modify', 'read', 'list', 'delete', 'approve'], 'webpage': ['list'],
'organization': ['subsidiaries_list', 'channel_list', 'video_list'],
'account': ['list', 'modify_self', 'read_self'], 'catalog': []}]
new_d = {};
for item in d:
for key in item.keys():
if key not in new_d:
new_d[key] = item[key]
else:
new_d[key] = list(set(new_d[key] + item[key]))
print(new_d)
若有帮助,望采纳!