[Tutor] map one file and print it out following the sequence

Alan Gauld alan.gauld at btinternet.com
Tue Sep 27 21:08:23 CEST 2011


On 27/09/11 14:45, lina wrote:
> Hi,
>
> I have file 1: cur.itp
>
>       1       CH3     1  CUR      C1     1    0.066  15.0350
>       2        OA     1  CUR      O1     1   -0.183  15.9994
>       3         C     1  CUR      C2     1    0.126  12.0110
>
> and file 2: procesed.pdb
>
> ATOM      1  H52 CUR     1      33.502  30.958  -9.831 -0.71
> -0.23           H
> ATOM      2  H32 CUR     1      34.440  28.421  -3.916  0.00
> 0.09           H
> ATOM      3  H22 CUR     1      31.110  22.839   1.886 -0.18
> 0.12           H
>

While it's good to show us sample data please keep it to the minimum 
needed to illustrate the point.


> Now I wish the file 2 filed 3 output as the order of the file 1 field 2,
> namely will be,
> ATOM     10  C21 CUR     1      30.599  28.677 -10.410 -0.06
> -0.05           C
> ATOM     11  O4  CUR     1      30.948  29.625  -9.382 -0.04
> 0.04           O

Sorry, I have no idea what you mean by that.
Can you explain again in more detail please?


> hope someone can give me some advice,

We probably can once we understand what you are trying to do.
Or maybe its just me being slow...

> origs=open("processedpdb").read().split()
> print " ".join([mapping[orig] for orig in origs])
>
> the last sentence I even don't know what I am doing. sorry.

That makes two of us!

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list