with上下文管理器
http://blog.csdn.net/Shiroh_ms08/article/details/53859475
# 玩with语句 class TestWith(object): def __init__(self): print("this is init of TestWith") def if_exist(self): print("I'm here") def __enter__(self): print("This is TestWith __enter__") return self def __exit__(self, *args): for i in args: print(i) print("Now __exit__") with TestWith() as t: t.if_exist()