Hi: I would like to delete everything from column 54 on for each line beginning with "ATOM". In the example in the attachment (sorry for the attachment; I found no way with Google mail to have plain text mail) the new line would become:
ATOM 49 NH1 ARG 84 84.628 41.570 44.395 without any blank space to the right. . Everything else should remain at its original column. I have been looking for ???? statement, unable (my big fault ) to find a right one. I tried with slices % but it becomes unnecessarily complex. Thanks francesco
# Sample line # 1 2 3 4 5 6 7 8 # 012345678901234567890123456789012345678901234567890123456789012345678901234567890 # ATOM 49 NH1 ARG 84 84.628 41.570 44.395 0.00 0.00 N data = open('rec.crg', 'r') outp = open('rec.strip.crg', 'w') for L in data: if L[3] == 'M': L = L[:55] ??????? outp.write(L)
-- http://mail.python.org/mailman/listinfo/python-list