[Tutor] swapping lines between files

Bala subramanian bala.biophysics at gmail.com
Mon Mar 23 17:39:32 CET 2009


Dear Friends,

Thanks for your replies for my previous mail.

I have two files as follows.

file 1         file2
200           1         3.55
210           2         4.55
242           3         1.22
248           4         3.10
256            5        1.11

Now i have to replace 1,2,3,4,5 in *file 2* with 200,210,242,248,256 in *
file1*. Simply *replacing position 1 in file2 with values in file1*. Can i
do it with zip function, if yes how to do it. Here both files contain same
number of lines.

Thanks,
Bala
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090323/b94186fe/attachment.htm>


More information about the Tutor mailing list