Remove duplicate content from a list It is inevitable that you will run into situations where you are generating a python list from other content (web scraping for example), and you want to remove those duplicates. This is the code you would use: mylist = ["a", "b", "a", "c", "c"] mylist = list(dict.fromkeys(mylist)) You would change out 'mylist' with the actual name of your list and then run that command (mylist = list(dict.fromkeys(mylist))) Now, without going into the details of how this is working (because that really doesn't matter at this point), your list is now de-duplicated! And at this point you are able to continue on with whatever work you are doing.