标签:
>>> s = "jihite" >>> s.center(10, "*") ‘**jihite**‘ >>> s.ljust(10, "*") ‘jihite****‘ >>> s.rjust(10, "*") ‘****jihite‘
center,ljust,rjust分别把字符串放在10个*的中央、靠左、靠右。注:字符窜要替换*的位置,如果超过*的个数,直接就没有*了,例如:
>>> s ‘jihite‘ >>> s.center(3, ‘*‘) ‘jihite‘
>>> 5 * ‘*‘ ‘*****
标签:
原文地址:http://www.cnblogs.com/kaituorensheng/p/5399064.html