select count(*) from student where age>18 group by 性别 having count(*)>2 order by age
where过滤的是行,having过滤的是分组
select name,parent_name from student ,parent where student.id = parent.id
update student set age=16 where id='11'
delete from student where id='11'
同时遍历两个list:
for pos ,val in zip(_order,temp)
公共的key
a.keys() & b.keys()
读文件
with open("aa.txt") as f:
data=f.read()
可接受任意数量的位置参数和关键字参数:
def tst(*args,**kwargs):
排序 匿名函数
names=["11","ASDF","SDF11"]
sorted(names,key=lambda name:name.lower())
什么时候需要用装饰器
调用父类方法 super
class GanSu(find.FindIt):
def __init__(self,wfinfos,db_poc,db_meta,moment,find_gap,begin_time,named_by_gid,newfind_gap,delta=1,delta_day=2):
super(GanSu,self).__init__(wfinfos,named_by_gid,db_poc,db_meta,moment=moment,find_gap=find_gap,begin_time=begin_time,delta=delta,delta_day=delta_day)
self.newfind_gap=newfind_gap
0 :移到行首
$ : 移到行尾
gg: 跳到第一行
20G:跳到第20行
3<enter> : 光标向下移动3行
/word : 向光标之下寻找
?word :向光标之上查找
:1,$s/word1/word2/g :从第一行到最后一行替换
:n1,n2s/word1/word2/g :从n1行到n2行进行替换