1 #!/usr/bin/env python
2 # _*_ coding: UTF-8 _*_
3 # Author:taoke
4 def applePrice(func):
5 def otherfunc():
6 print(
"apple : 5$")
7 func()
8 return otherfunc
9
10 @applePrice
11 def displayApple():
12 print(
"apple : red")
13
14 displayApple()
apple : 5$apple : red
转载于:https://www.cnblogs.com/taoke2016/p/7471399.html
相关资源:python 装饰器的使用示例
转载请注明原文地址: https://win8.8miu.com/read-1489338.html