print(“Prediction accuracy: {:.3f}“.format(accuracy))

tech2022-08-07  122

{:.3f} 表示浮点数的精度为3(小数位保留3位)

print(‘test:{0:3f}’.format(math.pi)) 同样,3表示输出宽度。

最新回复(0)