python strip()函数 介绍
来源:互联网 发布:c语言神奇海螺 编辑:程序博客网 时间:2024/06/05 22:59
函数原型
声明:s为字符串,rm为要删除的字符序列
s.strip(rm) 删除s字符串中开头、结尾处,位于 rm删除序列的字符
s.lstrip(rm) 删除s字符串中开头处,位于 rm删除序列的字符
s.rstrip(rm) 删除s字符串中结尾处,位于 rm删除序列的字符
注意:
1. 当rm为空时,默认删除空白符(包括'\n', '\r', '\t', ' ')
>>> a = ' 123'>>> a.strip()'123'>>> a='\t\tabc''abc'>>> a = 'sdff\r\n'>>> a.strip()'sdff'
2.这里的rm删除序列是只要边(开头或结尾)上的字符在删除序列内,就删除掉。
>>> a = '123abc'>>> a.strip('21')'3abc' 结果是一样的>>> a.strip('12')'3abc'
阅读全文
0 0
- python strip()函数 介绍
- python strip()函数 介绍
- python strip()函数 介绍
- python strip()函数 介绍
- python strip()函数 介绍
- python strip()函数介绍
- python strip()函数 介绍
- python--strip()函数 介绍
- python strip()函数 介绍
- Python strip()函数 介绍
- 【Python】 strip(),split()函数介绍
- python strip()函数
- python中的strip函数
- python strip()函数
- Python的strip函数
- python strip()函数
- python strip() split()函数
- python strip()函数
- ZOJ--1005:Jugs(dfs)
- 傅里叶-梅林变换实现图像配准
- map和set
- JAVA Swing日期选择控件datepicker的使用
- Springboot MyBatis多数据源切换
- python strip()函数 介绍
- 移动端开发的简单适配方案
- jilu
- 汇编语言: 以下面形式定义一个长整数,其所占用字节数由 N 得到,试编写一个程序,实现对 N 字节的 NUM 的值求补,并把求补后的值仍保存在 NUM 中。
- JBPM(一)---JBPM简介及其开发环境搭建
- Strings of Power
- Android的surfaceView讲解
- 转:typedef函数指针的用法(C++)
- 一个机器学习博士生的忠告