摘要: HttpResponse 方法一: return HttpResponse('ok',headers={'xxx':'xxx'}) 方法二: obj = HttpResponse('ok') obj['yyy'] = 'yyy' # 像字典一样放入,最终会放在http的响应头中 return obj 阅读全文
posted @ 2023-11-30 15:19 wellplayed 阅读(6) 评论(0) 推荐(0) 编辑
摘要: 需要用到FunctionType和MethodType from types import FunctionType, MethodType 准备测试用代码 写一个函数: def add(): pass 写一个类: class Person: def run(self): pass @classme 阅读全文
posted @ 2023-11-30 15:07 wellplayed 阅读(5) 评论(0) 推荐(0) 编辑