Security_Code/COMMON_CODE半成品-不再更新/自定义日志文件.py

7 lines
238 B
Python

# coding:utf-8
# 传入可以是列表或者字符串
import time
def log(*args):
with open('log.txt', 'a+')as aa:
for x in args:
aa.write(str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + ':' + x + '\n')