I have a large file in which some sections appear as follows.
ATOM 1 N GLY A 8 10.001 3.812 45.690 1.00 44.05 N
ATOM 2 CA GLY A 8 9.207 4.845 44.955 1.00 42.92 C
ATOM 3 C GLY A 8 9.481 4.660 43.462 1.00 42.00 C
I need a python code that replaces the values in indexes 56-59 ("1.00" s) with "0.00". Similarly, the code replaces values in indexes 61-65 (44.05, 42.92, and 42.00) with "0.00". I expect an output as follows. Is there anyone who can assist me?
ATOM 1 N GLY A 8 10.001 3.812 45.690 0.00 0.00 N
ATOM 2 CA GLY A 8 9.207 4.845 44.955 0.00 0.00 C
ATOM 3 C GLY A 8 9.481 4.660 43.462 0.00 0.00 C
Here is the primary code I use.
# Open the file
pdb_text = open("b.txt","r")
# Read contents of the pdb file to string
#rline = ""
lines=pdb_text.readlines()
for line in lines:
rline = line.replace("1.00","0.00")
print(rline)