Python String模块
来源:互联网 发布:靠谱的分装小样店 知乎 编辑:程序博客网 时间:2024/06/05 00:22
replace(string,old,new[,maxsplit])
字符串的替换函数,把字符串中的old替换成new。默认是把string中所有的old值替换成new值,如果给出maxsplit值,还可控制替换的个数,如果maxsplit为1,则只替换第一个old值。
>>>a="11223344">>>print string.replace(a,"1","one")oneone2223344>>>print string.replace(a,"1","one",1)one12223344
capitalize(string)
该函数可把字符串的首个字符替换成大字。
>>> import string>>> print string.capitalize("python")Python
split(string,sep=None,maxsplit=-1)
从string字符串中返回一个列表,以sep的值为分界符。
>>> import string>>> ip="192.168.3.3">>> ip_list=string.split(ip,'.')>>> print ip_list['192', '168', '3', '3']
join(string[,sep])
返回用sep连接的字串,默认的sep是空格。
>>> import string>>> a = ['a','b','c']>>> b = string.join(a,'-')>>> b'a-b-c'>>> a['a', 'b', 'c']
0 0
- python 之 string() 模块
- python string模块
- python string模块
- <python>string模块详解
- python string模块
- python string模块
- python之string模块
- Python String模块
- python string模块
- python中的string模块
- python学习--string模块
- python字符串String模块
- python模块random&string
- Python random string模块
- python--string模块
- python字符串方法 string模块
- python中string字符串模块
- python基础模块之-string
- 在美国成功IPO不久的盛大以
- 静态代理模式设计
- java 图片旋转
- 解决相机拍照不清晰,拍照旋转问题!
- 任务驱动教学法在JAVA教学中的问题和策略
- Python String模块
- python调用dll中特定函数的两种方式(ctypes)
- Web_PHP_DedeCMS补丁更新后{dede:php}标签不起作用问题;
- Java 多态 父类引用子类对象
- web 前端学习
- jQuery取id有.的值
- 第七周作业
- TCP三次握手、四次挥手 过程说明
- iOS 证书相关概念