python 自己写个调试工具
建议直接使用logging模块
代码
# -*- coding:utf-8 -*-
import time
import sys
def get_now_time():
"""
获取当前日期时间
:return:当前日期时间
"""
now = time.localtime()
now_time = time.strftime("%Y-%m-%d %H:%M:%S", now)
# now_time = time.strftime("%Y-%m-%d ", now)
return now_time
def write_log(path, data):
"""
像文件中写入内容,可追加
:param path:文件路径
:param data:写入内容
:return:
"""
now_time = get_now_time(