摘要:with主要为了解决资源释放问题,可以简化代码,下面是两种应用with的例子: 1、通过重写__enter__和__exit__方法实现: 2、通过上下文管理器实现:
阅读全文
posted @ 2018-12-31 13:48
posted @ 2018-12-31 13:48
posted @ 2018-12-31 11:49
posted @ 2018-12-31 00:16
posted @ 2018-12-30 11:17