def clean_list_v2(list): id_list = [] obj_2_del = [] for obj in list: if obj['id'] in id_list: #list.remove(obj) obj_2_del.append(obj) continue id_list.append(obj['id'])
def clean_list_v3(list): id_list = [] new_list = [] for obj in list: if obj['id'] not in id_list: new_list.append(obj) id_list.append(obj['id']) continue
def clean_list_v4(list): id_list = [] new_list = [] for obj in list: if obj['id'] not in id_list: new_list.append(obj) id_list.append(obj['id']) continue
list.clear() for obj in new_list: list.append(obj)