Hi all! I was hoping I could get some help. I have a input file of data in 5 columns
eg.
A 1 10 B 0.7
B 1 203 A 0.98
C 2 805 C 0.99
...
So what I'm trying to do, is when each item in the first column (A,B,C) is equal to the item in the 4th column (B,A,C) I want to rearrange the last column and print the columns 1,2,3,and 5 with the correct values. Like this below.
A 1 10 0.98
B 1 203 0.7
C 2 805 0.99
This is what I have been working with at the moment,
for line in in_file:
number = line.split()
for col in number[0]:
if col == number[3]:
print number[0], number[1], number[2], number[4]
It should be pretty easy, but I just can't get any of the things I've been doing to work out. So I would appreciate any suggestions as to how to go about it.