06 2021 档案

子序列和最大
摘要:def demo(nums): dp=[nums[0]] for i in nums[1:]: dp.append(max(i,dp[-1]+i)) return max(dp) print(demo([-2,1,-3,4,-1,2,1,-5,4])) 阅读全文

posted @ 2021-06-23 09:41 HHMLXL 阅读(32) 评论(0) 推荐(0) 编辑

python grpc
摘要:grpc 远程过程调用 优势:采用protobuf二进制消息,效率高;序列化后消息体积小;节省网络流量;序列化和反序列化直接对应程序中数据类;劣势:protobuf二进制可读性差 使用protobuf数据传输,protobuf是一种数据交换格式,由三部分构成proto 文件 :使用的proto语法的 阅读全文

posted @ 2021-06-22 15:30 HHMLXL 阅读(216) 评论(0) 推荐(0) 编辑

python 单例模式
摘要:# __new__ class Demo: def __new__(cls, *args, **kwargs): if not hasattr(cls,'_instance'): cls._instance=super().__new__(cls) return cls._instance a=De 阅读全文

posted @ 2021-06-17 15:31 HHMLXL 阅读(35) 评论(0) 推荐(0) 编辑

sanic 类视图
摘要:from sanic import Sanic from sanic.response import json from sanic.websocket import WebSocketProtocol # app = Sanic("websocket_example") from sanic im 阅读全文

posted @ 2021-06-16 12:20 HHMLXL 阅读(46) 评论(0) 推荐(0) 编辑

sanic websocket
摘要:from sanic import Sanic from sanic.response import json from sanic.websocket import WebSocketProtocol app = Sanic("websocket_example") @app.websocket( 阅读全文

posted @ 2021-06-16 11:57 HHMLXL 阅读(104) 评论(0) 推荐(0) 编辑

sanic版本
摘要:# 版本,Blueprint('/',version=1) # http://127.0.0.1:8000/v1 # 在蓝图中也可添加 from sanic import Sanic from sanic.response import json app=Sanic("app") @app.post 阅读全文

posted @ 2021-06-16 11:13 HHMLXL 阅读(76) 评论(0) 推荐(0) 编辑

sanic蓝图
摘要:'''蓝图层次结构化路由,将应用程序逻辑划分为多个组或职责区域,类似于django多个app的url.py和setting.py的url.py例如:不同模块负责不同功能,路由前缀不同/api/t/?name="aw"/api/s/?name="sw"注册蓝图t=Blueprint('t',url_p 阅读全文

posted @ 2021-06-16 10:42 HHMLXL 阅读(98) 评论(0) 推荐(0) 编辑

sanic 路由
摘要:from sanic import Sanic from sanic.response import json,file app=Sanic("app") # @app.route('/',methods=['POST']) async def test(request): name=request 阅读全文

posted @ 2021-06-16 10:26 HHMLXL 阅读(55) 评论(0) 推荐(0) 编辑

sanic请求响应
摘要:# pip install sanic from sanic import Sanic from sanic.response import json,file app=Sanic("app") ''' 请求 get 获取参数 request.args.get("") post 获取参数 reque 阅读全文

posted @ 2021-06-16 10:00 HHMLXL 阅读(209) 评论(0) 推荐(0) 编辑

gorm
摘要:package main import ( "fmt" // "log" "github.com/jinzhu/gorm" _ "github.com/jinzhu/gorm/dialects/mysql" ) // 表定义 type Student struct { ID uint `gorm:" 阅读全文

posted @ 2021-06-10 15:58 HHMLXL 阅读(28) 评论(0) 推荐(0) 编辑

go log
摘要:package main import ( "log" "os" ) var ( Info *log.Logger Warning *log.Logger Error * log.Logger ) func main(){ logFile,error:=os.OpenFile("./log.log" 阅读全文

posted @ 2021-06-01 22:25 HHMLXL 阅读(43) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示