with工作原理

进入时,调用对象的__enter__

退出时,调用对象的__exit__

原文地址:https://www.cnblogs.com/themost/p/6821354.html