怎么理解 Python 文档中的这句话,python这句话,"The use of


"The use of the else clause is better than adding additional code to the try clause because it avoids accidentally catching an exception that wasn’t raised by the code being protected by the try ... except statement."
https://docs.python.org/3/tutorial/errors.html
看了半天没琢磨明白用 else 相比直接写到 try 里有什么好处
补充:"wasn’t raised by the code ..." 具体指什么情况? 举个例子?

编橙之家文章,

评论关闭