使用 f-string
print(f"y1/y2: {y1:.6e}/{y2:.6e}")
# y1/y2: 4.282000e-11/1.562123e-10
使用%
print('%d %s cost $%.2f' % (6, 'bananas', 1.74))
# 6 bananas cost $1.74
标签:输出,格式化,bananas,Python,1.74,print,cost,y1,y2
来源: https://www.cnblogs.com/yaos/p/14049789.html