exception捕捉异常exception

import traceback,logging
logger = logging.getLogger()

def 方法1try:
            print("start to run train algo!")

        except Exception as e:
            trace_back = traceback.format_exc()
            logger.error(trace_back)
            logger.error(e)
            return False

你可能感兴趣的:(java,python,开发语言)