I am appending items into a list, and I do not want copies.
empty_list = []
empty_list.append('some_item')
I would like to check whether an exact "copy" of the item already exists in the list. If so, I would like to the item NOT to append.
I think one should write an if statement to check whether the item already exists in the list. If so, do not append.
if 'some_item' not in empty_list:
empty_list.append('some_item')
else:
pass
Is there a Python method/function which does this?
EDIT: This is a duplicate question, it appears. However, the answers provided below seem better than the previous question's.