python自定义注解

 1 def print_log_before_action(fn):
 2     def print_log(*arg):
 3         print("before execute fn")
 4         return fn(*arg)
 5 
 6     return print_log
 7 
 8 
 9 @print_log_before_action
10 def print_hello(name: str):
11     print("hello python: " + name)
12 
13 
14 if __name__ == '__main__':
15     # print("test")
16     print_hello("guanxianseng")

 

posted on 2025-12-24 23:01  luckygxf  阅读(0)  评论(0)    收藏  举报

导航