From b48b0adb009aeacee616486dd59077b1b9543b18 Mon Sep 17 00:00:00 2001
From: BellCodeEditor <bellcode_dev@bell.ai>
Date: Sun, 4 Jun 2023 16:45:36 +0800
Subject: [PATCH] save project

---
 diy.py | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/diy.py b/diy.py
index 5186396..0df510f 100644
--- a/diy.py
+++ b/diy.py
@@ -1,10 +1,20 @@
 # 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本'
-with open(r'D:\123.txt','w',encoding='utf-8') as file1:
+new_data=' '
+with open(r'C:\Users\刘龙佳\Desktop\123.txt','w',encoding='utf-8') as file1:
    for data in file1:
       if '小强: 10本' in data:
-          print('文件中')
+         data=data.replace('小强: 10','小强: 11')
       if '小兰: 12本' in data:
-          print('文件中')
+         data=data.replace('小兰: 12','小兰: 14')
+      new_data +=data
+
+with open(r'C:\Users\刘龙佳\Desktop\123.txt','w',encoding='utf-8') as file1:
+   file1.write(new_data)
+with open(r'C:\Users\刘龙佳\Desktop\123.txt','r',encoding='utf-8') as file1:
+   a=file1.read()
+   print(a)
+
+          
 
 
 
--
libgit2 0.25.0