I have file in which each line contains 3 "fields" separated by pipe-sign. So each line looks like :
AA10SchedTbl|ddmmyy|comxxx.xxx.xxx|
AC01_systSchedTbl|ddmmyy|comxxx.xxx.xxx|
....
I need to create a set containing the first field of each line I use following code which works but I don't think this is the most efficient way, any suggestions ?
with open(filename,"r") as file1:
refercycles = file1.readlines()
reference=set()
for lines in refercycles:
line=lines.split('|')
x=line[0].strip()
reference.add(x)