I have a list of dictionaries each of them describing a file (file format, filename, filesize, ... and a full path to the file [always unique]). The goal is to exclude all but one dictionaries describing copies of the same file (I just want a single dict (entry) per file, no matter how many copies there are.
In other words: if 2 (or more) dicts differ only in a single key (i.e. path) - leave only one of them).
For example, here is the source list:
src_list = [{'filename': 'abc', 'filetype': '.txt', ... 'path': 'C:/'},
{'filename': 'abc', 'filetype': '.txt', ... 'path': 'C:/mydir'},
{'filename': 'def', 'filetype': '.zip', ... 'path': 'C:/'},
{'filename': 'def', 'filetype': '.zip', ... 'path': 'C:/mydir2'}]
The result should look like this:
dst_list = [{'filename': 'abc', 'filetype': '.txt', ... 'path': 'C:/'},
{'filename': 'def', 'filetype': '.zip', ... 'path': 'C:/mydir2'}]