让我们说吧
numbers = [ 0.7653, 10.2, 100.2325, 500.9874 ]
我想通过改变小数位数来输出具有固定宽度的数字,以获得如下输出:
0.7653 10.200 100.23 500.98
是否有捷径可寻?我一直在试图用各种%f和%d配置,没有运气.
%f
%d
python string numbers fixed-width
fixed-width ×1
numbers ×1
python ×1
string ×1