Re: [Tutor] how to sort the file out

2011-09-07 Thread lina
On Wed, Sep 7, 2011 at 4:52 PM, Peter Otten <__pete...@web.de> wrote: > lina wrote: > >> HI, I have two files, one is reference file, another is waiting for adjust >> one, >> >> File 1: >> >> 1 C1 >> 2 O1 > [...] >> 33 C19 >> 34 O5 >> 35 C21 >> >> File 2: >> 3 H16 >> 4 H5 > [...] >> 39 H62 >> 40 O2

Re: [Tutor] how to sort the file out

2011-09-07 Thread Peter Otten
lina wrote: > HI, I have two files, one is reference file, another is waiting for adjust > one, > > File 1: > > 1 C1 > 2 O1 [...] > 33 C19 > 34 O5 > 35 C21 > > File 2: > 3 H16 > 4 H5 [...] > 39 H62 > 40 O2 > 41 H22 > > I wish the field 2 from file 2 arranged the same sequence as the field > 2

Re: [Tutor] how to sort the file out

2011-09-06 Thread lina
For file 1, 1 C1 2 O1 3 C2 4 C3 5 H3 This one is much more like dictionary, ; nr atom cgnr charge mass 1 C1 10.062 15.0350 2 O1 1 -0.139 15.9994 3 C2 10.064 12.0110 4 C3 1 -0.001 12.0110

Re: [Tutor] how to sort the file out

2011-09-06 Thread bodsda
I'm also slightly confused. Why does file one start at 1, but file 2 starts at 3. Why not just duplicate file2? Bodsda Sent from my BlackBerry® wireless device -Original Message- From: lina Sender: tutor-bounces+bodsda=googlemail@python.org Date: Wed, 7 Sep 2011 12:46:37 To: tutor

Re: [Tutor] how to sort the file out

2011-09-06 Thread Hugo Arts
I was assuming that the numbers were field 1, and the letter/number combinations were field 2. If I understand him correctly, he wants the lines in file 2 to be arranged such that the order of field two is the same as it is in file 1. In that case, you can do it with one sexy sort() call (and a lit

Re: [Tutor] how to sort the file out

2011-09-06 Thread Jordan
Perhaps a little more information on what is going on and what the expected outcome is. In order for the tutors to be able to better help you as I am not sure what you expect to get from these two lists. IE there is no field 2 in file 2, so what should it be? Also what should happen to the rest of