python 学习笔记12(序列常用方法总结)
2016-05-13 18:26
881 查看
http://www.cnblogs.com/vamei/archive/2012/07/19/2599940.html
多回想!!!1. 序列(list,tuple,string)
len(s)min(s)
max(s)
any(s)
all(s)
2. 表和定值表(list,tuple):
sum(s)s.count(x)
s.index(x)
3. 表 list:
list1.extend(list2)list1.append(x)
list1.sort()
list1.reverse()
list1.pop()
del list1[1]
4. 字符串:
str.count(sub)str.find(sub)
str.index(sub)
str.rfind(sub)
str.rindex(sub)
5. 字符串判断
str.isalnum()str.isalpha()
str.isdigit()
str.istitle()
str.isspace()
str.islower()
str.isupper()
str.split([sep, [max]])
str.rsplit([sep, [max]])
str.rsplit(',')
str.join(s)
str.strip([sub])
str.replace(sub, new_sub)
str.capitalize()
str.lower()
str.upper()
str.swapcase()
str.title()
str.center(width)
str.ljust(width)
str.rjust(width)
相关文章推荐
- PIL处理图片之加水印
- python监听本地目录,并将目录下的文件同步到远端服务器
- Python
- python中操作数据库中游标的使用方法
- python中with语句的用法
- 如何查找在python中的模块和方法
- python中cString模块
- [LeetCode][Python]Integer Break
- python中全局变量
- Python单例模式终极版
- python 3D绘制立体几何
- Python常见问题(7):Python图形用户接口 Graphic User Interface FAQ
- Python常见问题(6):Python在Windows上的问题 Python on Windows FAQ
- Python常见问题(5):Python扩展与嵌入 Extending/Embedding FAQ
- Python常见问题(4):Python库与扩展 Library and Extension FAQ
- Python常见问题(3):设计与历史 Design and History FAQ
- Python 装饰器,@property 以及 Pycaffe.py
- python里面的高级特性
- python 中删除文件中的空白行(回车)
- Python查看函数代码内容