I have this list:
mylist = [['TX', 'DALLAS'],
['TX', 'DALLAS'],
['CA', 'LA'],
['CA', 'LA'],
['ID', 'BOISE']],
I've been trying to write a loop that makes a new list containing only those that were duplicates.
This is my current code:
for i in mylist:
if mylist.count(i) > 1:
mylist.remove(i)
mylist
my output:
[['TX', 'DALLAS'], ['CA', 'LA'], ['ID', 'BOISE']]
So the output would be:
[['TX', 'DALLAS'], ['CA', 'LA']],