博客园 - 刘珲的博客
uuid:24b78886-0ed1-41c2-8670-e3f31dcf42c4;id=173212
2020-08-28T06:31:34Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
feed.cnblogs.com
https://www.cnblogs.com/Liu-Hui/p/13577236.html
django解决Object of type Decimal is not JSON serializable - 刘珲的博客
class DecimalEncoder(json.JSONEncoder): def default(self, o): if isinstance(o, decimal.Decimal): return float(o) super(DecimalEncoder, self).default(o
2020-08-28T06:24:00Z
2020-08-28T06:24:00Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
【摘要】class DecimalEncoder(json.JSONEncoder): def default(self, o): if isinstance(o, decimal.Decimal): return float(o) super(DecimalEncoder, self).default(o <a href="https://www.cnblogs.com/Liu-Hui/p/13577236.html" target="_blank">阅读全文</a>
https://www.cnblogs.com/Liu-Hui/p/13401308.html
redis中的hash - 刘珲的博客
Redis 哈希(Hash) 在Redis中,hash哈希被称为字典(dictionary),Redis的字典使用哈希表作为底层实现,一个哈希表里面可以有多个哈希表节点,而每个哈希表节点保存了字典中的一个键值对。实际上,Redis数据库底层也是采用哈希表来存储键值对的。 Redis中的哈希采用了典型
2020-07-29T15:20:00Z
2020-07-29T15:20:00Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
【摘要】Redis 哈希(Hash) 在Redis中,hash哈希被称为字典(dictionary),Redis的字典使用哈希表作为底层实现,一个哈希表里面可以有多个哈希表节点,而每个哈希表节点保存了字典中的一个键值对。实际上,Redis数据库底层也是采用哈希表来存储键值对的。 Redis中的哈希采用了典型 <a href="https://www.cnblogs.com/Liu-Hui/p/13401308.html" target="_blank">阅读全文</a>
https://www.cnblogs.com/Liu-Hui/p/13400835.html
什么是hash? - 刘珲的博客
1.什么是hash算法Hash(散列、杂凑)算法,是把任意长度的输入通过特定的算法变换成固定长度的输出,输出的值就是hash值。这个特定的算法就叫hash算法,hash算法并不是一个固定不变的算法。只要是能达到这个目的的算法都可以说hash算法。例如MD5,SHA,String.hashcode()
2020-07-29T14:52:00Z
2020-07-29T14:52:00Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
【摘要】1.什么是hash算法Hash(散列、杂凑)算法,是把任意长度的输入通过特定的算法变换成固定长度的输出,输出的值就是hash值。这个特定的算法就叫hash算法,hash算法并不是一个固定不变的算法。只要是能达到这个目的的算法都可以说hash算法。例如MD5,SHA,String.hashcode() <a href="https://www.cnblogs.com/Liu-Hui/p/13400835.html" target="_blank">阅读全文</a>
https://www.cnblogs.com/Liu-Hui/p/13393597.html
什么是python中的继承 - 刘珲的博客
什么是python中的继承? 当一个类继承自另一个类, 他就被称为子类(派生类),继承自父类(基类,超类).他会继承(获取)所有类成员(属性和方法). 继承能让我们重新使用代码(也就是代码的复用),也能更容易的创建和维护应用. python支持如下种类的继承: 单继承:一个类继承自单个基类. 多继承
2020-07-29T14:32:00Z
2020-07-29T14:32:00Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
【摘要】什么是python中的继承? 当一个类继承自另一个类, 他就被称为子类(派生类),继承自父类(基类,超类).他会继承(获取)所有类成员(属性和方法). 继承能让我们重新使用代码(也就是代码的复用),也能更容易的创建和维护应用. python支持如下种类的继承: 单继承:一个类继承自单个基类. 多继承 <a href="https://www.cnblogs.com/Liu-Hui/p/13393597.html" target="_blank">阅读全文</a>
https://www.cnblogs.com/Liu-Hui/p/13392237.html
redis为什么是单线程以及redis为什么这么快? - 刘珲的博客
Redis为什么这么快 1、完全基于内存,绝大部分请求是纯粹的内存操作,非常快速。数据存在内存中,类似于HashMap,HashMap的优势就是查找和操作的时间复杂度都是O(1); 2、数据结构简单,对数据操作也简单,Redis中的数据结构是专门进行设计的; 3、采用单线程,避免了不必要的上下文切换
2020-07-29T14:31:00Z
2020-07-29T14:31:00Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
【摘要】Redis为什么这么快 1、完全基于内存,绝大部分请求是纯粹的内存操作,非常快速。数据存在内存中,类似于HashMap,HashMap的优势就是查找和操作的时间复杂度都是O(1); 2、数据结构简单,对数据操作也简单,Redis中的数据结构是专门进行设计的; 3、采用单线程,避免了不必要的上下文切换 <a href="https://www.cnblogs.com/Liu-Hui/p/13392237.html" target="_blank">阅读全文</a>
https://www.cnblogs.com/Liu-Hui/p/13388194.html
AttributeError: module 'time' has no attribute 'clock' - 刘珲的博客
在python3.8中flask项目运行报错: AttributeError: module 'time' has no attribute 'clock'解决方案 主要原因是因为python3.8中不支持clock了, 需要替换成time.pref_counter()替换就可以了 修改后已经正常启
2020-07-27T14:44:00Z
2020-07-27T14:44:00Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
【摘要】在python3.8中flask项目运行报错: AttributeError: module 'time' has no attribute 'clock'解决方案 主要原因是因为python3.8中不支持clock了, 需要替换成time.pref_counter()替换就可以了 修改后已经正常启 <a href="https://www.cnblogs.com/Liu-Hui/p/13388194.html" target="_blank">阅读全文</a>
https://www.cnblogs.com/Liu-Hui/p/13275981.html
MySQL常见面试题 - 刘珲的博客
事务四大特性 1.原子性:不可分割的操作单元,事务中所有操作,要么全部成功;要么撤回到事务执行之前的状态 2.一致性:如果在执行事务之前数据库是一致性的,那么在执行事务后数据库也还是一致的 3.隔离性:事务操作之间彼此独立和透明互不影响。事务独立运行。这通常使用锁来实现。一个事务处理后的结果,影响了
2020-07-21T15:52:00Z
2020-07-21T15:52:00Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
【摘要】事务四大特性 1.原子性:不可分割的操作单元,事务中所有操作,要么全部成功;要么撤回到事务执行之前的状态 2.一致性:如果在执行事务之前数据库是一致性的,那么在执行事务后数据库也还是一致的 3.隔离性:事务操作之间彼此独立和透明互不影响。事务独立运行。这通常使用锁来实现。一个事务处理后的结果,影响了 <a href="https://www.cnblogs.com/Liu-Hui/p/13275981.html" target="_blank">阅读全文</a>
https://www.cnblogs.com/Liu-Hui/p/13260146.html
python分块读取大数据,避免内存不足 - 刘珲的博客
2020-07-07T04:55:00Z
2020-07-07T04:55:00Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
【摘要】 <a href="https://www.cnblogs.com/Liu-Hui/p/13260146.html" target="_blank">阅读全文</a>
https://www.cnblogs.com/Liu-Hui/p/13258380.html
关于邮箱发送邮件二之附件及图片 - 刘珲的博客
import smtplibfrom email.mime.text import MIMETextfrom email.header import Headerfrom email.mime.multipart import MIMEMultipartfrom email.mime.base im
2020-07-06T15:37:00Z
2020-07-06T15:37:00Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
【摘要】import smtplibfrom email.mime.text import MIMETextfrom email.header import Headerfrom email.mime.multipart import MIMEMultipartfrom email.mime.base im <a href="https://www.cnblogs.com/Liu-Hui/p/13258380.html" target="_blank">阅读全文</a>
https://www.cnblogs.com/Liu-Hui/p/13255457.html
关于邮箱发送邮件 - 刘珲的博客
import smtplibfrom email.mime.text import MIMETextfrom email.header import Header# come_from 是自己的邮箱,password是邮箱的授权码come_from = '2577452716@qq.com'# wh
2020-07-06T08:30:00Z
2020-07-06T08:30:00Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
【摘要】import smtplibfrom email.mime.text import MIMETextfrom email.header import Header# come_from 是自己的邮箱,password是邮箱的授权码come_from = '2577452716@qq.com'# wh <a href="https://www.cnblogs.com/Liu-Hui/p/13255457.html" target="_blank">阅读全文</a>
https://www.cnblogs.com/Liu-Hui/p/13254165.html
关于算法 - 刘珲的博客
面试题 def num(): return [lambda x: i*x for i in range(4)]print([m(2) for m in num()]) # 输出: [6, 6, 6, 6] 思路: 这题涉及到了闭包延时绑定,当循环执行完了之后才会执行传参,循环四次,每一次循环完 i=
2020-07-06T04:21:00Z
2020-07-06T04:21:00Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
【摘要】面试题 def num(): return [lambda x: i*x for i in range(4)]print([m(2) for m in num()]) # 输出: [6, 6, 6, 6] 思路: 这题涉及到了闭包延时绑定,当循环执行完了之后才会执行传参,循环四次,每一次循环完 i= <a href="https://www.cnblogs.com/Liu-Hui/p/13254165.html" target="_blank">阅读全文</a>
https://www.cnblogs.com/Liu-Hui/p/13254155.html
python中常见的数据类型 - 刘珲的博客
str 常用方法 1. 索引(下标) s = 'ABCDEFGHIJKLMN's1 = s[0]print('s[0] = ' + s1) #s[0] = A 2. 切片:顾头不顾尾 s = 'ABCDEFGHIJKLMN's2 = s[0:3]print('s[0:3] = ' + s2) #s[
2020-07-06T04:18:00Z
2020-07-06T04:18:00Z
刘珲的博客
https://www.cnblogs.com/Liu-Hui/
【摘要】str 常用方法 1. 索引(下标) s = 'ABCDEFGHIJKLMN's1 = s[0]print('s[0] = ' + s1) #s[0] = A 2. 切片:顾头不顾尾 s = 'ABCDEFGHIJKLMN's2 = s[0:3]print('s[0:3] = ' + s2) #s[ <a href="https://www.cnblogs.com/Liu-Hui/p/13254155.html" target="_blank">阅读全文</a>