本文实例讲述了python常见的设计模式。分享给大家供大家参考,具体如下: # #!/usr/bin/env python # # -*- coding:utf-8 # # class HttpBase: # def get(self): # psss # class Http1(HttpBase): # def get(self): # print 'http1' # class Http2(HttpBase): # def get(self): # print 'http2' # # # class Base: # def __init__(sel
2023-10-04 10:29:16 39KB python python函数 python反射
1
1 将下面代码拷贝到一个文件,命名为asyncore.py 复制代码 代码如下:import socketimport selectimport sys def ds_asyncore(addr,callback,timeout=5):    s=socket.socket(socket.AF_INET,socket.SOCK_STREAM)    s.connect(addr)    r,w,e = select.select([s],[],[],timeout)    if r:        respose_data=s.recv(1024)        callback(respos
2021-10-08 16:43:43 30KB python python反射 python实例
1