import time def timing_decorator(func): def wrapper(*args, **kwargs): start_time = time.time() result = func(*args, **kwargs) end_time = time.time() print(f"{func.__name__} executed in {end_time - start_time} seconds") return result return wrapper @timing_decorator def example_function(): time.sleep(1) example_function()

相关推荐

牛客网
牛客企业服务