zl程序教程

您现在的位置是:首页 >  其他

当前栏目

追加写入json文件的方式记录日志

文件日志JSONJSON 方式 记录 写入 追加
2023-09-27 14:29:08 时间
"""
@author: zhangjun.xue
@time: 2019/12/26 21:42
@file: add_log_to_json_file.py
@desc: 追加写入json文件的方式记录日志
"""
import os
import json

logging = {
            "sample_garment_flag": sample_garment_flag
        }

temp_file = os.path.join(os.getcwd(), 'create_project_logging.txt')
print('$$$$$$$$$$$$$$$$$$$$$$$ temp_file = {}'.format(temp_file))
# 追加写入json文件的方式记录日志
json.dump(logging, open(temp_file, 'a'), indent=4)