Python-strip(),lstrip(),rstrip()
来源:互联网 发布:常见20网络诈骗 编辑:程序博客网 时间:2024/06/11 14:54
去掉字符串中满足要求的部分
[chars] 如果被省略的话,默认去掉 连续的空格。
我对于这个的理解有一点儿问题。而且不是很能理解,手册上面给出的例子。
对于chars argument is a string specifing the set of characters to be removed ,这句话 不是很懂。
在此mark,理解好了后回来更新。
20161104日下午17点更新
上午在像前辈请教了以后总算是理解了Python strip操作的规则了。
拿一下代码为例子:
>>> 'www.example.com'.strip('comwz.')'example'
lstrip(),rstrip()与strip()的区别就是只按照一个特定的方向,当不满足条件的时候就停止。
>>> 'www.example.com'.lstrip('comwz.')'example.com'>>> 'www.example.com'.rstrip('comwz.')'www.example'
更多例子:
>>> '#!....!!#@!haha!@LUCKY!@..!%^#'.strip('#!.^@%')'haha!@LUCKY'
0 0
- strip,lstrip,rstrip Python
- python- strip lstrip rstrip
- Python-strip(),lstrip(),rstrip()
- python:strip()、rstrip()、lstrip()
- python-strip lstrip rstrip
- Python strip lstrip rstrip使用方法
- python strip lstrip rstrip 用法
- Python strip lstrip rstrip使用方法
- Python strip lstrip rstrip使用方法
- Python strip lstrip rstrip使用方法
- Python strip lstrip rstrip使用方法
- Python strip lstrip rstrip使用方法
- Python strip lstrip rstrip使用方法
- Python strip lstrip rstrip使用方法
- Python strip lstrip rstrip使用方法
- Python strip lstrip rstrip使用方法
- Python strip lstrip rstrip使用方法
- Python strip lstrip rstrip使用方法
- scala基本语法及注意点
- iOS 开发 XMPP即时通讯项目开发(仿微信)-详解之openfire服务器失败问题
- Python3的语法学习
- vim的powerline插件没有颜色
- 2016个推详细配置详解
- Python-strip(),lstrip(),rstrip()
- 多线程下载
- java File和Byte[]数组 相互转换
- python scp 批量同步文件
- g09莫名崩溃原因
- Android Volley完全解析
- HDU-4081-Qin Shi Huang's National Road System
- 加密解密实现和原理
- 设计模式总结之策略模式