From 978bfcad233700d926e1a14fbb7b5a88cad84bb8 Mon Sep 17 00:00:00 2001 From: f18326186224 Date: Thu, 30 Nov 2023 03:44:25 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E9=80=9A=E8=BF=87github=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- update_data.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/update_data.py b/update_data.py index ffca349..90664ef 100644 --- a/update_data.py +++ b/update_data.py @@ -2,16 +2,16 @@ import json import requests -with open('data.json', mode='r+',encoding='utf-8') as my_file: - text = my_file.read() - data = json.loads(text) - # 新增数据 - data.append({ - 'name': '新数据', - 'age': 18 - }) - # 写入文件 - with open('data.json', mode='w+',encoding='utf-8') as my_file: - my_file.write(json.dumps(data)) +# with open('data.json', mode='r+',encoding='utf-8') as my_file: +# text = my_file.read() +# data = json.loads(text) +# # 新增数据 +# data.append({ +# 'name': '新数据', +# 'age': 18 +# }) +# # 写入文件 +# with open('data.json', mode='w+',encoding='utf-8') as my_file: +# my_file.write(json.dumps(data)) print('已更新数据!') \ No newline at end of file