python 字符串函数
2015-10-19 21:14
525 查看
from string import maketrans title = "come out Linda~" print title.find("Linda")#9 print title.find("linda")#-1 seq = ["a","b","c","d","e"] sep = "*" print sep.join(seq)#a*b*c*d*e name = "LINDA" print name.lower()#linda print "This is a test".replace("is","eez")#Theez eez a test print "1*2*3*4*5".split("*")#['1', '2', '3', '4', '5'] print ' hello ' print ' hello '.strip()#hello print '@#$%^&hello@#$!%^&'.strip('@#$%^&')#hello@#$! table = maketrans('cs','kz') print 'this is a incredible test'.translate(table)#thiz iz a inkredible tezt print "Done!Tada!!"
#后面是输出结果咯~
相关文章推荐
- 解决python源代码中编码问题
- Python学习要点(0x00)
- python 获取星期几
- python 判断学期与学年
- Python下ORM的一个设计举例
- Python2.x与3.x版本区别
- python 去除不可见的控制字符
- 源码安装python
- Python下异步IO和协程简介
- Python中assert的用法
- python+Eclipse+pydev环境搭建
- python排序算法和实现
- Python技巧——list与字符串互相转换
- 定位 python image not found问题
- python字符串操作,以及截取对应的C#函数
- Python 在Visual studio 中做单元测试进行TDD开发
- 模拟登录新浪微博(Python) - 转
- Eclipse环境安装Python插件PyDev
- python实现ssh自动化登录遇到的坑
- Python快速教程