我是新手,我只是想了解这个with陈述.我明白它应该替换try/ exceptblock.
现在假设我做了这样的事情:
try:
name='rubicon'/2 # to raise an exception
except Exception as e:
print "no not possible"
finally:
print "Ok I caught you"
Run Code Online (Sandbox Code Playgroud)
如何用上下文管理器替换它?