摘要: 上下文管理器:实现__enter__方法和__exit__方法的类就是一个上下文管理器: 示例代码: from contextlib import ContextDecorator class Mycontext(ContextDecorator): def __enter__(self): pri 阅读全文
posted @ 2019-12-01 22:37 王军的个人博客 阅读(106) 评论(0) 推荐(0) 编辑