📜  格式化位数 python 代码示例

📅  最后修改于: 2022-03-11 14:46:50.493000             🧑  作者: Mango

代码示例1
# credit to Stack Overflow user in source link
# x is a floating point number
# a is the total width of the field being printed, lefted-padded by spaces.
# b is the number of digits after the decimal point

print("{:a.bf}".format(x))