Python3 에서 sys.argv 를 사용하여 Command별 분기처리하기
if __name__ == "__main__": command_executors = { 'validate': command_validate, 'test': command_test, 'help': command_help } command = command_executors.get(sys.argv[1]) try: command() sys.exit(0) except Exception as e: logger.error('error=%s\nTraceback:%s' % (str(e), traceback.format_exc())) sys.exit(1)
Last updated 5 years ago
Was this helpful?