随笔- 310
文章- 1
评论- 0
阅读-
85655
09 2024 档案
python jwt加密与解密
摘要:安装 pip install PyJWT example import datetime import jwt #pip install PyJWT # PyJWT-2.8.0 secret_key="test" payload = { 'user_id': 12345, 'username': '
阅读全文
多个装饰器修改一个函数
摘要:def outter_1(func1): def inner_1(*args, **kwargs): # 使用不定长参数 print("inner_1内容") func1(*args, **kwargs) print("第一个装饰器 1") return inner_1 def outter_2(f
阅读全文
python 装饰器类
摘要:from functools import wraps class logit(object): def __init__(self, logfile='out.log'): self.logfile = logfile def __call__(self, func): @wraps(func)
阅读全文
python 带参数的装饰器
摘要:from functools import wraps def logit(logfile='out.log'): def logging_decorator(func): @wraps(func) def wrapped_function(*args, **kwargs): log_string
阅读全文