with...as用法

with (as)其实等价于:

  try:

    (执行__enter__)

    do somrthing

  finally:

    (执行__exit__)

 

传送门:https://blog.csdn.net/qiqicos/article/details/79200089

posted @ 2020-12-26 10:35  Vincent_Qi  阅读(165)  评论(0)    收藏  举报