更新时间:2023-12-05 17:45:58
你可以用对齐的格式添加。#f
。
You can just add the .#f
in the format with the alignment.
with open('format_test.dat', "a") as f_out:
f_out.write('''{:>10.2f} {:>15.4f} {:>16.5f} {:>15.3f}'''.format(a, b, c, d))
f_out.write('\n')