首页 > 编程语言 > 详细

python str.center()

时间:2017-01-24 21:54:22      阅读:226      评论:0      收藏:0      [点我收藏+]
print(‘while循环‘.center(20,‘-‘))

>>> ------while循环-------

str.center(width[, fillchar])

Return centered in a string of length width. Padding is done using the specified fillchar (default is an ASCII space). The original string is returned if width is less than or equal to len(s).

 

翻译:返回一个居中过的字符串,用指定字符填充(默认是用ascii位置)

原始的字符串的宽度小于或者等于len(s)的话就返回原始字符串

 

python str.center()

原文:http://www.cnblogs.com/ezway/p/6347852.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!