- print('
- while循环'.center(20, ' - '))
- >>> ------
- while循环-------
- str.
([,])
- center
Return centered in a string of length . Padding is done using the specified (default is an ASCII space). The original string is returned if is less than or equal to
.
- len(s)
翻译:返回一个居中过的字符串,用指定字符填充(默认是用 ascii 位置)
原始的字符串的宽度小于或者等于 len(s) 的话就返回原始字符串
来源: