摘要: get curl -G http://www.xxxx.com/show?userId=111 post curl -d "username=sunnyxd&password=12345" http://www.xxxx.com/show https://stackoverflow.com/ques 阅读全文
posted @ 2021-08-27 19:24 玉北 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1、基础的打桩方式 # stub.py import mock import need def myfunc(): pass need.func = mock.MagicMock(side_effect=myfunc) # need.py def func(): pass # main.py imp 阅读全文
posted @ 2021-08-26 10:33 玉北 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 记录进程报错信息 子进程资源被父进程释放导致子进程退出 阅读全文
posted @ 2021-08-26 10:03 玉北 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 普通装饰器 from functools import wraps def cover(func): @wraps(func) def wrapper(*args, **kwargs): result = func(*args, **kwargs) return result return wrap 阅读全文
posted @ 2021-08-23 14:28 玉北 阅读(25) 评论(0) 推荐(0) 编辑
摘要: LOG_PATH = os.path.abspath(os.path.join(os.getcwd(), "..", "logs")) logging.basicConfig(level=logging.DEBUG, filename=os.path.join(LOG_PATH, 'output.l 阅读全文
posted @ 2021-06-19 11:27 玉北 阅读(66) 评论(0) 推荐(0) 编辑
摘要: def multipliers(): return [lambda x: i * x for i in range(4)] print([m(2) for m in multipliers()]) # [6, 6, 6, 6] multipliers内嵌套了一个匿名函数 该匿名函数引用外部非全局变量 阅读全文
posted @ 2021-06-12 10:24 玉北 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 管理员权限运行cmd route -p add 192.168.0.2 mask 255.255.0.0 192.168.0.1 使用route print查看 route delete 192.168.0.2 使用route print查看 增加的路由应该指向网段,这里应该写route -p ad 阅读全文
posted @ 2021-05-06 14:59 玉北 阅读(654) 评论(0) 推荐(0) 编辑
摘要: 换源 -i https://pypi.tuna.tsinghua.edu.cn/simple 清华源 -i http://mirrors.aliyun.com/pypi/simple --trusted-host mirrors.aliyun.com 阿里源 阅读全文
posted @ 2021-05-05 13:34 玉北 阅读(36) 评论(0) 推荐(0) 编辑
摘要: 创建环境(路径:venv所处的路径/环境名) python3 -m venv 路径 进入环境 windows 路径/Scripts/activate linux source 路径/bin/activate 阅读全文
posted @ 2021-04-26 15:11 玉北 阅读(96) 评论(0) 推荐(0) 编辑
摘要: 1. lambda x: x * i 与 lambda x, i=i: x * i 的区别 def multipliers(): # 添加了一个默认参数i=i return [lambda x: i * x for i in range(4)] print([m(2) for m in multip 阅读全文
posted @ 2021-04-25 21:49 玉北 阅读(66) 评论(0) 推荐(0) 编辑