Oct-01-2020, 02:18 PM
I am trying to append to a set and getting the following error:
AttributeError: 'dict' object has no attribute 'append'
Best,
David
AttributeError: 'dict' object has no attribute 'append'
lst = [3, 3, 22, 22, 1, 4, 5, 6, 10, 20, 40, 40, 40, 50] dup_free = [] dup_free_set = {} for x in lst: if x not in dup_free: dup_free.append(x) dup_free_set.append(x) # error here print(dup_free_set)Is there a function/way to do this?
Best,
David