From 95c1ae248d0855d760562aedcccb45206bf0e35c Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sun, 2 Apr 2023 09:42:00 +0800 Subject: [PATCH] save project --- diy.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 diy.py diff --git a/diy.py b/diy.py new file mode 100644 index 0000000..169b977 --- /dev/null +++ b/diy.py @@ -0,0 +1,16 @@ +new_data='' +with open(r'C:"C:\Users\Makcoo1\Desktop\book.txt','r'eenc='utef-8')as filel + for data in filel: + if '小强:10本' in data: + data=data.replace('小强:10','小强:11') + if '小兰:12本' in data: + data=data.replace('小兰:12','小兰:14') + new_data +=data + +with open(r'C:"C:\Users\Makcoo1\Desktop\book.txt','r'eenc='utef-8')as filel + filel.write(new_data) + + +with open(r'C:"C:\Users\Makcoo1\Desktop\book.txt','r'eenc='utef-8')as filel + a=filel.read() + print(a) \ No newline at end of file -- libgit2 0.25.0