字符串左对齐补齐占位10个
# 格式化字符串 name='fqs' age=18 hobby='game' print(f'第一种name:{name:10},age:{age:10}') print('第二种name:{0:10},age:{1:10}'.format(name,age)) print('第三种name:{0:>10},age:{1:<10},hobby:{2:^10}'.format(name,age,hobby)) print('第四种name:{0:>010},age:{1:<010},hobby:{2:^010}'.format(name,age,hobby)) ''' 第一种name:fqs ,age: 18 第二种name:fqs ,age: 18 第三种name: fqs,age:18 ,hobby: game 第四种name:0000000fqs,age:1800000000,hobby:000game000 '''