目录
1.数值计算
**平方
类型转换 int()、float()、str()
函数 abs()、round()
2.数据类型
1.字符串
切分和合并 split()、join()
替换 replace()
大小写转换 upper()、lower()
去掉空格 strip()
打印输出 "{} {}".format("ab","cd")、"%s %s"%("ab","cd")
计数 count()
求位置 index()
2.列表
索引和切片
与字符串的切换 list()
删除 del a[ ]、remove()
添加 append()
插入 insert(第几个位置, )
弹出 pop()
insert与append相比,计算代价更高,如果要在序列的头部和尾部都插入元素,可以探索下collections.deque
排序 sort() 改变原有顺序 、sorted() 不改变原有顺序
3.元组 tuple 元组内元素不可改变
4.字典
dict()
key:value
5.集合
是一 种 无序 且 元素 唯一 的 容器( 最大作用是去重)
并集union() a|b
交集intersection() a&b
Python中type()、len() R中为class()、length()
Python中定义一个函数define() R中定义一个函数function{}