1
358.0 11.3 6.9 12.8 0.0069
359.6 273.8 149.8 101.6 0.0069
我想上面的线是在以下格式如何调整文本行?
358.0 11.3 6.9 12.8 0.0069
359.6 273.8 149.8 101.6 0.0069
我在下面试图“rjust”,如:
with open(infilename) as f:
next(f)
for lines in f:
line = lines.split()
l = line[0].rjust(25) + line[1].rjust(10) + line[2].rjust(10) + line[3].rjust(10) + line[4].rjust(10) + '\n'
“rjust”添加到最后的价值,但我想每一列首先参照极左,以便所有列均匀分布。有什么建议么?
谢谢。我用'line [0] .rjust(25)+ line [1] .ljust(10)......'解决了这个问题。 – Ibe
你应该真的在使用'.format()' –