import json
import os
import shutil
import time
# import objectpath
import sys
import datetime
true = "true"
false = "false"
null = "null"
from datetime import datetime, timedelta
with open('./notificationsManagement/notifications.json') as json_file:
data = json.load(json_file)
day_start = 30
for tuple in data:
tuple['creationTime'] -= int(timedelta(days = day_start).total_seconds())
day_start -= 2
print(data)
text_file = open("output.json", "w")
text_file.write(str(data))
text_file.close()
我写了一个脚本,以便:
读取 Json 文件
执行修改
打印数据
将新的有效 Json 文件输出为“output.json”
我遇到的几个问题:
Json 的元组乱序
数据在每个标题前用“u”打印
新文件包含相同的“u”(主要问题)
有什么建议?
绝地无双
慕妹3146593
相关分类