Python内的center函数

时间:2020-07-19 16:00:15   收藏:0   阅读:89

Center(width,filename):
技术图片

因为str_test长度为12(包括空格),所以左右填充‘-’的长度一共为8,左右便都填充4个‘-’;如果要填充的filename为单数,则左边填充的filename向下取整,右边填充的向上取整。

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!