Hi: In a pdb file made of lines "ATOM .." (see attachment as I was unable to obtain plain text with gmail) I would like to reposition the second "W" from column 19 to 17 ( (Python numbering; in pdb numbering it would be 20 18). I started with bold slices, then I was unable to complete the script. Much obliged for help.
francesco pietra
# Sample line # Slice indexes cut to the left of the corrresponding item index # 1 2 3 4 5 6 # 012345678901234567890123456789012345678901234567890123456789012345 ... # ATOM 1 W W 1 0.690 35.960 33.300 1.00 0.00 data = open('out.2.5.2.5.2.0.pdb', 'r') outp = open('rect.out.2.5.2.5.2.0.pdb', 'w') for L in data: if L[19] == 'W': L = ???? outp.write(L)
-- http://mail.python.org/mailman/listinfo/python-list