gpt4 book ai didi

Python rstrip()方法实例详解

转载 作者:qq735679552 更新时间:2022-09-27 22:32:09 25 4
gpt4 key购买 nike

CFSDN坚持开源创造价值,我们致力于搭建一个资源共享平台,让每一个IT人在这里找到属于你的精彩世界.

这篇CFSDN的博客文章Python rstrip()方法实例详解由作者收集整理,如果你对这篇文章有兴趣,记得点赞哟.

Python 字符串 。

描述 。

Python rstrip() 删除 string 字符串末尾的指定字符(默认为空格). 。

语法 。

rstrip()方法语法:

str.rstrip([chars]) 。

参数 。

chars – 指定删除的字符(默认为空格) 。

返回值 。

返回删除 string 字符串末尾的指定字符后生成的新字符串.

实例 。

以下实例展示了rstrip()函数的使用方法:

?
1
2
3
4
5
#!/usr/bin/python
str = " this is string example…wow!!! " ;
print str .rstrip();
str = 88888888this is string example…wow!!! 8888888 ”;
print str .rstrip(‘ 8 ');

以上实例输出结果如下:

 this is string example....wow!!.

88888888this is string example…wow!!.

总结 。

以上所述是小编给大家介绍的Python rstrip()方法实例详解,希望对大家有所帮助,如果大家有任何疑问欢迎给我留言,小编会及时回复大家的! 。

原文链接:https://blog.csdn.net/qq_42194192/article/details/83957835 。

最后此篇关于Python rstrip()方法实例详解的文章就讲到这里了,如果你想了解更多关于Python rstrip()方法实例详解的内容请搜索CFSDN的文章或继续浏览相关文章,希望大家以后支持我的博客! 。

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com