print("float占8位留2位小數:{:8.2f}——默認右對齊".format(1192.68123))
print("float占18位留2位小數:{:18.2f}——默認右對齊".format(1192.68123))
print("float占18位留2位小數:{:>18.2f}——右對齊".format(1192.68123))
print("float占18位留2位小數:{:<18.2f}——左對齊".format(1192.68123))
print("float占18位留2位小數:{:^18.2f}——居中對齊".format(1192.68123))
print("float留2位小數:{:.2f}——默認右對齊".format(1192.68123))
print("float留2位小數:{:>.2f}——右對齊".format(1192.68123))
print("float留2位小數:{:<.2f}——左對齊".format(1192.68123))
print("float留2位小數:{:<+.2f}——左對齊帶符號".format(1192.68123))
print("float留2位小數:{:<.2%}——左對齊百分比形式".format(0.6812345))
print("int占8位:{:<8d}——左對齊".format(1192))
print("int占8位:{:0<8d}——左對齊補0".format(1192))
print("int占8位:{:x<8d}——左對齊補x".format(1192))
print("int占8位:{:中<8d}——左對齊補中".format(1192))
print("int占8位:{:8d}——默認右對齊".format(1192))
print("int占8位:{:8d}——默認右對齊".format(1192))
print("int占22位:{:22e}——默認右對齊科學計數法".format(1230000))
print("int占22位:{:22,}——默認右對齊逗號分隔數字".format(1230000))
輸出結果:

