上一页 1 2 3 4 5 6 7 ··· 21 下一页

2020年7月31日

买卖股票的最佳时机 II(122)

摘要: 法一:class Solution: def maxProfit(self, prices: List[int]) -> int: ret = 0 for i in range(len(prices)): if i+1<len(prices): if prices[i]<prices[i+1]: r 阅读全文

posted @ 2020-07-31 11:27 不要挡着我晒太阳 阅读(169) 评论(0) 推荐(0) 编辑

2020年7月30日

最长公共前缀(14)

摘要: 法一:class Solution: def longestCommonPrefix(self, strs: List[str]) -> str: if not strs: return '' str_min = min(strs) str_max = max(strs) for i in rang 阅读全文

posted @ 2020-07-30 11:32 不要挡着我晒太阳 阅读(89) 评论(0) 推荐(0) 编辑

2020年7月29日

两个数组的交集II(350)

摘要: 法一:def intersect(nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ ans = [] nums1.sort() nums2.sort() i = j = 0 w 阅读全文

posted @ 2020-07-29 14:22 不要挡着我晒太阳 阅读(127) 评论(0) 推荐(0) 编辑

2020年5月25日

Django时区及naive datetime object和aware datetime object的区别

摘要: 相信使用Django的各位开发者在存储时间的时候经常会遇到这样子的错误: RuntimeWarning: DateTimeField received a naive datetime while time zone support is active. 准备 UTC与DST UTC可以视为一个世界 阅读全文

posted @ 2020-05-25 10:33 不要挡着我晒太阳 阅读(265) 评论(0) 推荐(0) 编辑

Django-guardian

摘要: 概述 django-guardian是为Django提供额外的基于对象权限的身份验证后端。 特征 Django的对象全新啊 匿名用户的支持 高级API 经过严密测试 Django admin的整合 装饰器 安装 要求Django1.7或更高版本 pip install django-guardian 阅读全文

posted @ 2020-05-25 10:17 不要挡着我晒太阳 阅读(2182) 评论(0) 推荐(0) 编辑

2020年4月15日

consul从安装到使用

摘要: 一、安装及简单实用 1.安装并加入环境变量 wget https://releases.hashicorp.com/consul/1.5.1/consul_1.5.1_linux_amd64.zip unzip consul_1.5.1_linux_amd64.zip -d /usr/local/b 阅读全文

posted @ 2020-04-15 17:15 不要挡着我晒太阳 阅读(443) 评论(0) 推荐(0) 编辑

2020年4月14日

创建索引的原则

摘要: 索引虽好,但也不是无限制的使用,最好符合一下几个原则 1) 最左前缀匹配原则,组合索引非常重要的原则,mysql会一直向右匹配直到遇到范围查询(>、<、between、like)就停止匹配,比如a = 1 and b = 2 and c > 3 and d = 4 如果建立(a,b,c,d)顺序的索 阅读全文

posted @ 2020-04-14 18:00 不要挡着我晒太阳 阅读(485) 评论(0) 推荐(0) 编辑

索引使用场景

摘要: where 根据id查询记录,因为id字段仅建立了主键索引,因此此SQL执行可选的索引只有主键索引,如果有多个,最终会选一个较优的作为检索的依据。 -- 增加一个没有建立索引的字段alter table innodb1 add sex char(1);-- 按sex检索时可选的索引为nullEXPL 阅读全文

posted @ 2020-04-14 17:14 不要挡着我晒太阳 阅读(1155) 评论(0) 推荐(0) 编辑

2020年4月13日

flask app.config

摘要: 配置方法: (1) 直接在文件中 写 app.config['xxx'] = 'xxx' app.config['DEBUG'] = True PS: 由于Config对象本质上是字典,所以还可以使用app.config.update(...) 注意: 某个对象 可以进行 a['aa'] = 111 阅读全文

posted @ 2020-04-13 18:39 不要挡着我晒太阳 阅读(1154) 评论(0) 推荐(0) 编辑

2020年4月10日

python验证企业统一信用码

摘要: _credit_id_weight = ( 1, 3, 9, 27, 19, 26, 16, 17, 20, 29, 25, 13, 8, 24, 10, 30, 28) def _is_credit_id_valid(oid: str) -> bool: if not isinstance(oid 阅读全文

posted @ 2020-04-10 15:46 不要挡着我晒太阳 阅读(289) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 7 ··· 21 下一页

导航