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)的话就返回原始字符串