class SQLHelper(object):
def __init__(self):
pass
def __enter__(self):# 进入--执行
return self
def __exit__(self, exc_type, exc_val, exc_tb):#退出--执行
pass
with SQLHelper() as obj:
print(obj)
print('正在执行')
class SQLHelper(object):
def __init__(self):
pass
def __enter__(self):# 进入--执行
return self
def __exit__(self, exc_type, exc_val, exc_tb):#退出--执行
pass
with SQLHelper() as obj:
print(obj)
print('正在执行')