使用format()
内容左侧填充对齐,format(‘string’,‘*>10’)
表示在字符串‘string’左侧填充‘*’使填充后字符串总长度为10
效果:****string
内容右侧填充对齐,format(‘string’,‘*<10’)
表示在字符串‘string’右侧填充‘*’使填充后字符串总长度为10
效果:string****
内容两侧侧填充对齐,format(‘string’,‘*^10’)
表示在字符串‘string’两侧填充‘*’使填充后字符串总长度为10
效果:**string**