2018年10月1日

redis自定义缓存

摘要: 1 import weakref, collections 2 import time 3 4 5 class LocalCache(): 6 notFound = object() 7 8 class Dict(dict): 9 def __del__(self): 10 pass 11 12 d 阅读全文

posted @ 2018-10-01 19:11 市外桃源 阅读(241) 评论(0) 推荐(0)

python常用标准库

摘要: 系统内建函数 1、字符串 str='这是一个字符串数据测试数据'对应 str[0]:获取str字符串中下标为0的字符。 str[3]:获取str字符串中下标为3的字符。 str[0:3]:获取到字符串中从下标为0到下标为3的字符串。 str.find():返回指定str字符串中是否存在指定的字符串数 阅读全文

posted @ 2018-10-01 13:52 市外桃源 阅读(124) 评论(0) 推荐(0)

2018年9月26日

元类

摘要: python中的造物者 1、注:key-- 函数的名字;value-空间地址 格式是: xx=type('类的名字',('父类的名字',),{‘key’:‘value’}) f=type('Aa',(object,),{'name':'lfj'}) l=f() print(f.name) 验证hel 阅读全文

posted @ 2018-09-26 16:33 市外桃源 阅读(108) 评论(0) 推荐(0)

2018年9月21日

liunx中 :TIME_WAIT状态的产生的原因?如何避免?

摘要: 看图说话:一般发生在TCP协议中 原理:右图第3个箭头-->>>服务端关闭时候: 服务器进入进入LAST_ACK状态。 第4个箭头服务器接收客户端请求后才关闭 原因:假如第3个箭头时候,浏览器突然关闭(服务器突然断开),TCP重新发送请求 可膜拜:https://www.cnblogs.com/su 阅读全文

posted @ 2018-09-21 17:38 市外桃源 阅读(613) 评论(0) 推荐(0)

2018年9月19日

关于打开文件写入

摘要: import os def print_directory_contents(sPath): # path 路径,--child产物 for sChild in os.listdir(sPath): sChildPath = os.path.join(sPath, sChild) if os.pat 阅读全文

posted @ 2018-09-19 20:57 市外桃源 阅读(134) 评论(0) 推荐(0)

python 多态的理解

摘要: 1 class Human(object): # 父类 :创建“人”类 2 3 def __init__(self): 4 5 print('Ill pound the code and buy you a bag') # 我会敲打码,给你买包包 6 7 class Man(Human): # 1) 阅读全文

posted @ 2018-09-19 20:45 市外桃源 阅读(943) 评论(0) 推荐(0)

导航