I have a list loaded in the from the hard drive, and bring up another list from the internet, both are town names. I want to combine the two lists together and remove any duplicate names so they only appear once in list from the hard drive. I saw an easy way of doing it for and if not to comparing them away and in a similar situation it worked but right now it is not removing the duplicates and instead it is giving me list one and list two, unedited when it gets written back out to the hard drive.
The original concept I used was
for x in townname:
if x not in towns:
towns.append(x)
print(x)
This just copies list2 to to list one and removes nothing. When I switch townname and towns around it does the exact opposite.
How do I get it to remove the duplicate while copying the rest from townname to towns?