I would like to retain the unique integer in the second column and print the entry in the previous (first) column. But I am having trouble converting a string to an integer and get the error: TypeError: 'int' object is not iterable
Input File
A 1 108.80
A 1 8.33
B 2 45.10
B 2 3.96
B 2 3.94
A 3 1.96
A 3 2.94
Output
A
B
A
Script
with open('test.pdb') as infile:
for line in infile:
data = int(line.split()[1])
seen = set()
for number in range(data):
unique = [x for x in number if x not in seen]
seen.update(unique)
print(unique)