【Python】 strip(),split()函数介绍
来源:互联网 发布:淘宝秒杀器taovb 编辑:程序博客网 时间:2024/06/05 04:50
strip()
声明: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'
Split()
0 0
- 【Python】 strip(),split()函数介绍
- python strip() split()函数
- python strip() split()函数
- python strip() split()函数
- Python strip() 和split() 函数
- python strip()函数 介绍
- python strip()函数 介绍
- python strip()函数 介绍
- python strip()函数 介绍
- python strip()函数 介绍
- python strip()函数介绍
- python strip()函数 介绍
- python--strip()函数 介绍
- python strip()函数 介绍
- Python strip()函数 介绍
- Python进阶---python strip() split()函数实战
- 【 Python进阶】python strip() split()函数实战
- python中strip() 函数和 split() 函数
- HDU4686 Arc of dream
- 简单无刷新文件上传系统
- 用Win32写的定时关机程序
- Android账户管理
- 关于oracle中查询语句 decode和 case when 的用法
- 【Python】 strip(),split()函数介绍
- Get the center of contour
- Poppler ~ okular ~ qpdfview
- View和自定义控件的绘制流程
- 1
- stb前端开发js性能优化总结
- DEDECMS 完善"图片集"功能
- 基于python的hadoop开源框架
- 代理模式