Python 3.x 带打印的Python3浮点的中心点
如何在Python3中以其Python 3.x 带打印的Python3浮点的中心点,python-3.x,Python 3.x,如何在Python3中以其为中心逐行打印浮点数 >>> print('{:6}\n{:6}'.format(2, 46)) 2 46 >>> print('{:.2f}\n{:.2f}'.format(2.34985, 82.23132)) 2.35 82.23 和处理整数的方法一样 print('{:6.2f}\n{:6.2f}'.format(2.34985, 82.23132)) 2.35 82.23
为中心逐行打印浮点数
>>> print('{:6}\n{:6}'.format(2, 46))
2
46
>>> print('{:.2f}\n{:.2f}'.format(2.34985, 82.23132))
2.35
82.23
和处理整数的方法一样
print('{:6.2f}\n{:6.2f}'.format(2.34985, 82.23132))
2.35
82.23