def my_decorator(func):          # 1. 接收原函数
    def wrapper():               # 2. 定义包装函数
        print("前处理")
        func()                   # 3. 调用原函数
        print("后处理")
    return wrapper               # 4. 返回包装函数

def hello():
    print("你好！")

hello = my_decorator(hello)      # 手动装饰
hello()
# 输出：
# 前处理
# 你好！
# 后处理
@my_decorator
def hello():
    print("你好！")

hello()