I have following list coming from file. what i want one of list of this file which containts many values duplicate one also
['S', 'F', '3', '\n']
['S', 'F', '3', '\n']
['S', 'F', '3', '\n']
['S', 'F', '3', '\n']
['S', 'F', '3', '\n']
['S', 'F', '3', '\n']
['S', 'F', '3', '\n']
['S', 'F', '3', '\n']
['S', 'F', '3', '\n']
['7', '3', '4', '\n']
['7', '3', '4', '\n']
['7', '3', '4', '\n']
['7', '3', '4', '\n']
How to filter out only unique values.
import os
os.chdir('C:\\')
if os.path.exists('xxx.dat'):
airport = open('routes.dat')
for each_line in airport:
(Airlinecode,AirlineID,Source_airport_code,Source_airport_ID,Destination_airport,Destination_airport_ID,Codeshare,Stops,Equipment) = each_line.split("\t")
newlist =[]
newlist = Equipment
i = iter(newlist)
elements = []
for eachitem in range(len(newlist)):
elements.append(i.next())
print (elements)
airport.close()
else:
print('file does not exists')