使用format()
內(nèi)容左側(cè)填充對(duì)齊躏升,format(‘string’,‘*>10’)
表示在字符串‘string’左側(cè)填充‘*’使填充后字符串總長度為10
效果:****string
內(nèi)容右側(cè)填充對(duì)齊崔慧,format(‘string’,‘*<10’)
表示在字符串‘string’右側(cè)填充‘*’使填充后字符串總長度為10
效果:string****
內(nèi)容兩側(cè)側(cè)填充對(duì)齊可缚,format(‘string’霎迫,‘*^10’)
表示在字符串‘string’兩側(cè)填充‘*’使填充后字符串總長度為10
效果:**string**