try catch in java/python/scala
try catch是代码里面非常实用捕获异常的方式
in java:
try{} catch (*Exception e) {e.printStackTrace(); dosomething(); } finally{}
in scala:
try{} catch { case e : * Exception => { e.printStackTrace(); dosomething();}}
in python 2.6 and before ?:
import traceback
try:
except Exception, e:
traceback.print_exec()
in python 2.7 and later:
import traceback
try:
except Exception as e:
traceback.print_exec()

浙公网安备 33010602011771号