我從來沒用過, 不過今天發現文檔中說
"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."
http://docs.python.org/2/tutorial/errors.html
但我仍然覺得多出個else clause不太方便, 並決定繼續不用.
"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."
http://docs.python.org/2/tutorial/errors.html
但我仍然覺得多出個else clause不太方便, 並決定繼續不用.