标签:param use python open content operation ret strftime pen
def write_log(username,operation):
‘‘‘
写日志函数
:param username:用户名
:param operation:用户的操作信息
:return:
‘‘‘
w_time = time.strftime(‘%Y-%m-%d %H%M%S‘)
with open(‘log.txt‘,‘a+‘) as fw:
log_content = ‘%s %s %s \n‘%(w_time,username,operation)
fw.write(log_content)
标签:param use python open content operation ret strftime pen
原文地址:http://www.cnblogs.com/snorth/p/7040032.html