# 为字符串添加HTML标签 import time def zhuang(fun): def zhaung_1(*args, **kargs): # time.sleep(1) html_str = "<h1>"+fun()+"</h1>" return html_str return zhaung_1 def zhuang1(fun): def zhaung_1(*args, **kargs): print("zhuang1") time.sleep(1) html_str1 = "<h1>" + fun() + "</h1>" return html_str1 return zhaung_1 @zhuang # 后执行 @zhuang1 # 先执行 def test(): content_str = "hello word" return content_str print(test())