def throw_if_true(param): try: if param: raise OSError("test exception") except OSError: print("except") finally: print("finally")throw_if_true(True)# 输出 "except" 和 "finally"throw_if_true(False)# 只输出 "finally"