'''
整数格式化
格式化一个整数,按10位输出,不足10位前面补0
'''
x1 = 1234
print(format(x1,'*>10d'))#******1234
print(format(x1,'*<10d'))#1234******
print(format(x1,'*^10d'))#***1234***
'''
浮点数格式化
格式化一个浮点数,保留两位小数
'''
x1 = 1234.56789
x2 = 30.1
print(format(x1,'0.2f'))#1234.56
print(format(x2,'.2f'))#30.10
'''
描述format函数的主要用法
'''
print(format(1234567890,','))#千位号分割 1,234,567,890
print(format(1245678.2148784545,',.3f'))#千位号分割,保留3位小数 1,245,678.215