标签:日志 port mod 时间 模块 strftime *args 函数 encoding
# 功能要求: 每一次调用函数之前, 要将函数名称, 时间节点记录到log的日志中.
# 所需模块:
# import time
#
# def logger(fn):
# def inner(*args, **kwargs):
# # fn.__name__ # 函数名字
# f = open("log", mode="a", encoding="utf-8")
# f.write("在%s, 访问了%s函数\n" % (time.strftime("%Y-%m-%d %H:%M:%S"), fn.__name__))
# ret = fn(*args, **kwargs)
# return ret
# return inner
#
#
# @logger
# def chi():
# print("wusir特别能吃")
# @logger
# def he():
# print("太白特别能和")
# @logger
# def shui():
# print("太黑特别能睡")
#
#
# chi()
# chi()
# he()
# chi()
# shui()
# shui()
# 功能要求: 每一次调用函数之前, 要将函数名称, 时间节点记录到log的日志中.
# 所需模块:
# import time
#
# def logger(fn):
# def inner(*args, **kwargs):
# # fn.__name__ # 函数名字
# f = open("log", mode="a", encoding="utf-8")
# f.write("在%s, 访问了%s函数\n" % (time.strftime("%Y-%m-%d %H:%M:%S"), fn.__name__))
# ret = fn(*args, **kwargs)
# return ret
# return inner
#
#
# @logger
# def chi():
# print("wusir特别能吃")
# @logger
# def he():
# print("太白特别能和")
# @logger
# def shui():
# print("太黑特别能睡")
#
#
# chi()
# chi()
# he()
# chi()
# shui()
# shui()
标签:日志 port mod 时间 模块 strftime *args 函数 encoding
原文地址:https://www.cnblogs.com/bpbl/p/10209235.html