1. import numpy as np
    2. a = 1.2333
    3. b = 2.5555555
    4. print("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

    具体的一些细节可以到菜鸟教程中查看