上一页 1 2 3 4 5 6 7 8 9 10 ··· 14 下一页
摘要: 必知必会13条 <1> all(): 查询所有结果 <2> filter(**kwargs): 它包含了与所给筛选条件相匹配的对象 <3> get(**kwargs): 返回与所给筛选条件相匹配的对象,返回结果有且只有一个,如果符合筛选条件的对象超过一个或者没有都会抛出错误。 <4> exclude 阅读全文
posted @ 2019-07-12 15:49 G先生 阅读(291) 评论(0) 推荐(0) 编辑
摘要: 匿名函数基础 首先,什么是匿名函数呢?以下是匿名函数的格式: lambda argument1, argument2,... argumentN : expression 我们可以看到,匿名函数的关键字是 lambda,之后是一系列的参数,然后用冒号隔开,最后则是由这些参数组成的表达式。我们通过几个 阅读全文
posted @ 2019-07-12 15:16 G先生 阅读(1005) 评论(0) 推荐(0) 编辑
摘要: def retry(times=3, second=1): # 重试时间为一秒,重试次数为3次 def decorator(func): def wrapper(*args, **kwargs): i = 0 result = func(*args, **kwargs) while not resu 阅读全文
posted @ 2019-07-12 09:49 G先生 阅读(319) 评论(0) 推荐(0) 编辑
摘要: 安装 APScheduler $ pip install apscheduler 快速开始 from apscheduler.schedulers.blocking import BlockingScheduler scheduler = BlockingScheduler() @scheduler 阅读全文
posted @ 2019-07-12 09:35 G先生 阅读(4301) 评论(0) 推荐(0) 编辑
摘要: 快速排序(quickSort) 快排的思想:首先任意选取一个数据(通常选用数组的第一个数)作为关键数据,然后将所有比它小的数都放到它前面,所有比它大的数都放到它后面,这个过程称为一趟快速排序。 百度百科给的算法: 一趟快速排序的算法是: 1)设置两个变量i、j,排序开始的时候:i=0,j=N-1; 阅读全文
posted @ 2019-07-03 16:17 G先生 阅读(596) 评论(0) 推荐(0) 编辑
摘要: 二叉树是有限个元素的集合,该集合或者为空、或者有一个称为根节点(root)的元素及两个互不相交的、分别被称为左子树和右子树的二叉树组成。 二叉树的每个结点至多只有二棵子树(不存在度大于2的结点),二叉树的子树有左右之分,次序不能颠倒。 二叉树的第i层至多有2^{i-1}个结点 深度为k的二叉树至多有 阅读全文
posted @ 2019-07-03 16:09 G先生 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 引子: print('' or 5 or 0) # 5 print(5 and 4) # 4 print('' or 5 or 0 and 4) # 5 出现以上情况的原因是什么呢? print(bool('')) # False print(bool(0)) # False 所有变量的位操作都是通 阅读全文
posted @ 2019-06-16 11:35 G先生 阅读(395) 评论(0) 推荐(0) 编辑
摘要: class Stack(object): def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append(item) def 阅读全文
posted @ 2019-06-09 12:01 G先生 阅读(1012) 评论(0) 推荐(0) 编辑
摘要: 假如有有in.txt I have a dream that my four little children will one day live in a nation where they will not be judged by the color of their skin but by t 阅读全文
posted @ 2019-05-27 16:45 G先生 阅读(492) 评论(0) 推荐(1) 编辑
摘要: MyISAM是MySQL的默认数据库引擎(5.5版之前),由早期的ISAM(Indexed Sequential Access Method:有索引的顺序访问方法)所改良。虽然性能极佳,但却有一个缺点:不支持事务处理(transaction)。不过,在这几年的发展下,MySQL也导入了InnoDB( 阅读全文
posted @ 2019-05-27 12:00 G先生 阅读(404) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 14 下一页

:guocheng