daily pastebin goal
30%
SHARE
TWEET

Untitled

a guest Aug 10th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. attribute_list = [
  2.     'Finish': 'Chrome',
  3.     'Size': 'Large',
  4.     'Weight': '1.6kg',
  5.     'Finish': 'Chrome',
  6.     'Weight': '1.9kg'
  7. ]
  8.    
  9. compiled_list = [
  10.     'Finish': 'Chrome',
  11.     'Size': 'Large'
  12. ]
  13.    
  14. duplicates_list = [
  15.     'Weight': '1.6kg',
  16.     'Weight': '1.9kg'
  17. ]
  18.    
  19. compiled_list = list()
  20. compiled_list_keys = list()
  21. duplicates_list = list()
  22. for attribute in attribute_list:
  23.     for k, v in attribute.items():
  24.         if k not in compiled_list_keys:
  25.             compiled_list_keys.append(k)
  26.             compiled_list.append(attribute)
  27.         else:
  28.             if attribute not in compiled_list:
  29.                 duplicates_list.append(attribute)
  30.                 compiled_list_keys.remove(k)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top