#总结函数的好处:代码重用,保持一致性,可扩展性
import time
def logger():
time_format = "%Y-%m-%d %X"
time_current = time.strftime(time_format)
with open("a.txt","a+") as f:
f.write("%s end action\n" %time_current)
def test1():
print("in the test1")
logger()
def test2():
print("in the test2")
logger()
def test3():
print("in the test3")
logger()
test1() #运行函数
test2()
test3()
函数的好处
最新推荐文章于 2021-11-24 13:07:59 发布