Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- attribute_list = [
- 'Finish': 'Chrome',
- 'Size': 'Large',
- 'Weight': '1.6kg',
- 'Finish': 'Chrome',
- 'Weight': '1.9kg'
- ]
- compiled_list = [
- 'Finish': 'Chrome',
- 'Size': 'Large'
- ]
- duplicates_list = [
- 'Weight': '1.6kg',
- 'Weight': '1.9kg'
- ]
- compiled_list = list()
- compiled_list_keys = list()
- duplicates_list = list()
- for attribute in attribute_list:
- for k, v in attribute.items():
- if k not in compiled_list_keys:
- compiled_list_keys.append(k)
- compiled_list.append(attribute)
- else:
- if attribute not in compiled_list:
- duplicates_list.append(attribute)
- compiled_list_keys.remove(k)
Add Comment
Please, Sign In to add comment