-
string的格式化输出方式
第一种方式:format函数
a="hello world"
format(a,"*^20")
输出:****hello world*****
第二种方式: %
'%-20s' % a或者 '%20s' % a
第三种方式: ljust,rjust函数
>>> text.rjust(20,'=')
'=========Hello World'
>>> text.center(20,'*')
'****Hello World*****'
'======================待续======================'