diff --git a/diy.py b/diy.py new file mode 100644 index 0000000..56e1a0f --- /dev/null +++ b/diy.py @@ -0,0 +1,17 @@ +file=open(r"C:\Users\双师001\Desktop\捐赠.txt","w",encoding='utf-8') +file.write("陈熙瑷:28\n") +file.write("邢钟月:47 \n") +file.close() +file=open(r"C:\Users\双师001\Desktop\捐赠.txt","r",encoding='utf-8') +a=file.readlines() +new_data="" +for data in a: + if "陈熙瑷:28" in data: + data=data.replace("陈熙瑷:28","陈熙瑷:29") + print("数据在") + new_data=new_data+data +print(new_data) + +file=open(r"C:\Users\双师001\Desktop\捐赠.txt","w",encoding='utf-8') + +file.write(new_data) \ No newline at end of file