python os模块
来源:互联网 发布:php 项目怎么维护的 编辑:程序博客网 时间:2024/06/07 04:43
os.linesep字符串给出当前平台使用的行终止符。例如,Windows使用'\r\n',Linux使用'\n'而Mac使用'\r'
strip()函数
函数原型
声明:s为字符串,rm为要删除的字符序列
s.strip(rm) 删除s字符串中开头、结尾处,位于 rm删除序列的字符
s.lstrip(rm) 删除s字符串中开头处,位于 rm删除序列的字符
s.rstrip(rm) 删除s字符串中结尾处,位于 rm删除序列的字符
注意:
1. 当rm为空时,默认删除空白符(包括'\n', '\r', '\t', ' ')
这里的rm删除序列是只要边(开头或结尾)上的字符在删除序列内,就删除掉。
>>> a = '123abc'
>>> a.strip('21')
'3abc' 结果是一样的
>>> a.strip('12')
'3abc'
0 0
- Python 模块学习:os模块
- Python 模块学习:os模块
- Python 模块学习:os模块
- Python 模块学习:os模块
- Python模块学习-os模块
- Python 模块学习:os模块
- Python 模块学习:os模块
- Python 模块学习:os模块
- Python 模块学习:os模块
- Python 模块学习:os模块
- Python 模块学习:os模块
- Python:os模块-subprocess模块
- Python 模块学习:os模块
- python模块之os模块
- Python 模块学习:os模块
- Python 模块学习:os模块
- Python 模块学习:os模块
- Python 模块学习:os模块
- 实现textfield的字数限制问题
- 关于PopuWindow的一个显示与隐藏切换的问题
- MFC中静态文本框贴图处理
- 获取后台数据中文有乱码的解决办法
- 【从MVC框架看MVC架构的设计】
- python os模块
- Bitwise AND of Numbers Range
- Linux下查看80端口是否被占用
- HI3516A模组与开发板产品出来了,效果非常OK!
- tomcat启动时报:IOException while loading persisted sessions: java.io.EOFException的解决方案
- iOS 利用mask layer 使view中扣掉一块露出下边的view
- js 去掉字符串前后空格
- iOS 从一个app打开另一个app
- iOS开发——为iOS工程创建模拟器包,用于其它电脑上iOS模拟器的运行测试(Creating an iOS Simulator Build)