从词典列表中删除重复项

pab*_*lox 6 python dictionary list

我有以下词典列表:

d = [
{ 'name': 'test', 'regions': [{'country': 'UK'}] },
{ 'name': 'test', 'regions': [{'country': 'US'}, {'country': 'DE'}] },
{ 'name': 'test 1', 'regions': [{'country': 'UK'}], 'clients': ['1', '2', '5'] },
{ 'name': 'test', 'regions': [{'country': 'UK'}] },
]
Run Code Online (Sandbox Code Playgroud)

从列表中删除重复条目的最简单方法是什么?

我看到了有效的解决方案,但前提是项目没有嵌套的dicts或列表

wim*_*wim 16

这个怎么样:

new_d = []
for x in d:
    if x not in new_d:
        new_d.append(x)
Run Code Online (Sandbox Code Playgroud)