小白教程
所有教程
关于
Search
172.70.126.231
172.70.126.231
参数设置
贡献
退出
操作
编辑
移动
保护
信息
历史
删除
查看“Python3 string rjust”的源代码
本页内容
上一节:
Python3_string_rindex
下一节:
Python3_string_rstrip
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
{{DISPLAYTITLE:rjust(width,[, fillchar])}}[[Category:python3 string|29]] = Python3 rjust()方法 = [[python3 string|Python3 字符串]] == 描述 == rjust() 返回一个原字符串右对齐,并使用空格填充至长度 width 的新字符串。如果指定的长度小于字符串的长度则返回原字符串。 == 语法 == rjust()方法语法: <sample title="" desc="" lang="python" hererun="1"> str.rjust(width[, fillchar]) </sample> == 参数 == * width -- 指定填充指定字符后中字符串的总长度. * fillchar -- 填充的字符,默认为空格。 == 返回值 == 返回一个原字符串右对齐,并使用空格填充至长度 width 的新字符串。如果指定的长度小于字符串的长度则返回原字符串 以下实例展示了rjust()函数的使用方法: <sample title="" desc="" lang="python" hererun="1"> #!/usr/bin/python3 str = "this is string example....wow!!!" print (str.rjust(50, '*')) </sample> 以上实例输出结果如下: <sample title="" desc="" lang="python" hererun="1"> ******************this is string example....wow!!! </sample> [[python3 string|Python3 字符串]]
返回至“
Python3 string rjust
”。
上一节:
Python3_string_rindex
下一节:
Python3_string_rstrip