@contextmanager这个decorator接受一个generator,用yield语句把with ... as var把变量输出出去,然后,with语句就可以正常地工作了
closing()它的作用就是把任意对象变为上下文对象,并支持with语句
Sign in to make a reply
KeMoing
@contextmanager这个decorator接受一个generator,用yield语句把with ... as var把变量输出出去,然后,with语句就可以正常地工作了
closing()它的作用就是把任意对象变为上下文对象,并支持with语句