立即学习:https://edu.csdn.net/course/play/26755/340159?utm_source=blogtoedu
1.with 语句用法
2.with 语句用于自定义的类
class Myclass:
def __enter__(self):
print('enter is run')
def py1(self,):
print('py1 is run')
def _exit__(self,):
print('exit is run',type,value,traceback)