面试题答案
一键面试def log_decorator(operation):
def decorator(func):
def wrapper(*args, **kwargs):
print(f'Starting {operation}')
result = func(*args, **kwargs)
print(f'Finished {operation}')
return result
return wrapper
return decorator
@log_decorator('operation')
def example_function():
print('Function is running...')
example_function()