Guest User

final

a guest
Sep 16th, 2015
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. def clean_list(list_to_clean):
  2. def del_list(list, x):
  3. dellist = []
  4. ter = (len(list)-1-x)
  5. y = x+1
  6. for i in range(ter):
  7. if list[x]==list[y] and type(list[x])== type(list[y]):
  8. dellist.append(y)
  9. y=y+1
  10. return dellist
  11. lent = len(list_to_clean)
  12. b = []
  13. x = 0
  14. for i in range(lent-1):
  15. b.extend(del_list(list_to_clean, x))
  16. x = x+1
  17.  
  18. b = list(set(b))[::-1]
  19. for i in b:
  20. del list_to_clean[i]
  21.  
  22. return list_to_clean
Advertisement
Add Comment
Please, Sign In to add comment