我写了一个python程序,我得到了这样的输出
ATOM OW HOH 6.016 23.68 63.478
ATOM OW HOH 11.522 24.153 61.585
ATOM OW HOH 10.849 26.167 62.012
ATOM OW HOH 6.774 23.656 63.543
ATOM OW HOH 8.255 22.341 66.519
ATOM OW HOH 8.891 23.732 67.313
ATOM OW HOH 9.193 25.411 67.03
ATOM OW HOH 8.208 25.255 67.332
但我想要像这样的输出
ATOM OW HOH 6.016 23.68 63.478
ATOM OW HOH 11.522 24.153 61.585
ATOM OW HOH 10.849 26.167 62.012
ATOM OW HOH 6.774 23.656 63.543
ATOM OW HOH 8.255 22.341 66.519
ATOM OW HOH 8.891 23.732 67.313
ATOM OW HOH 9.193 25.411 67.03
ATOM OW HOH 8.208 25.255 67.332
任何帮助都是可观的。
outfile2 = open('randomcoord.pdb', 'w')
hetam = 'ATOM OW HOH ' + ' ' + str(round(pacord[0], 3)) + ' ' + str(round(pacord[1], 3)) + ' ' + str(round(pacord[2], 3))
outfile2.write(hetam)
outfile2.write('\n')
outfile2.close()