import numpy as npa = 1.2333b = 2.5555555print("the format output of a and b is: {:.2f} and {:.2f}".format(a, b)) the format output of a and b is: 1.23 and 2.56 具体的一些细节可以到菜鸟教程中查看