python strip() split()
来源:互联网 发布:金融数据分析师待遇 编辑:程序博客网 时间:2024/06/07 16:06
>>> ipaddr = "10.122.19.10"
>>> ipaddr.strip()
'10.122.19.10'
>>> ipaddr = '10.122.19.10'
>>> ipaddr.strip()
'10.122.19.10'
>>> ipaddr.split('.')
['10', '122', '19', '10']
>>> ipaddr.strip().split('.')
['10', '122', '19', '10']
>>>
python strip()函数 介绍
函数原型
声明:s为字符串,rm为要删除的字符序列
s.strip(rm)
s.lstrip(rm)
s.rstrip(rm)
注意:
1. 当rm为空时,默认删除空白符(包括'\n', '\r',
例如:
复制代码 代码如下:
>>> a = '
>>> 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() split()函数
- python strip() split()函数
- python strip() split()函数
- python strip() split()
- python ''.join,split(),strip()
- Python: strip() & split()
- 【Python】 strip(),split()函数介绍
- python 中的split()和strip()
- python中的strip和split
- python中raw_input().strip().split()
- Python strip() 和split() 函数
- python 的 split 和 strip
- Python进阶---python strip() split()函数实战
- 【 Python进阶】python strip() split()函数实战
- data.strip().split(',')的用法 python
- python小贴士之strip() split()
- Python之strip与split函数
- python中strip和split的使用
- 17
- ubuntu16.04 ns2安装教程
- windows下配置redis集群,启动节点报错:createing server TCP listening socket *:7000:listen:Unknown error
- 搜索专题 M
- Android Material Design Lib
- python strip() split()
- HDU 2222 Keywords Search AC自动机
- 用python处理Excel文档(1)——用xlrd模块读取xls/xlsx文档
- 互联网下半场的基本玩法
- 单片机AD转换
- 加入创业公司之前必须要知道的6件事
- github发布正式版本---sourcetree工作流操作
- 学习Linux命令(6)
- 字字珠玑的百度员工离职总结