Commit 87af60d6 by BellCodeEditor

auto save

parent 3c390206
Showing with 5 additions and 1 deletions
......@@ -3,10 +3,14 @@ with open(r"C:\Users\EDY\Desktop\xx.txt","a",encoding="utf-8") as a:
a.write('小兰:12本')
a.write('小丽:11本')
a.write('张伟:16本')
new_data=""
with open(r"C:\Users\EDY\Desktop\xx.txt","r",encoding="utf-8") as a1:
for i in a1:
if '小兰:12本' in i:
print("在里面")
i=i.replace("小兰:12本","小兰:15本")
new_data+=i
with open(r"C:\Users\EDY\Desktop\xx.txt","w",encoding="utf-8") as a:
a.write(new_data)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment