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