Commit d9f20d38 by BellCodeEditor

save project

parent 04ccbe2d
Showing with 6 additions and 2 deletions
...@@ -5,11 +5,15 @@ ...@@ -5,11 +5,15 @@
# sb=open(r"C:\Users\燕子红\Desktop\123.txt","a",encoding="utf-8") # sb=open(r"C:\Users\燕子红\Desktop\123.txt","a",encoding="utf-8")
# sb.write("小丽:12本\n") # sb.write("小丽:12本\n")
# sb.close() # sb.close()
new=""
with open(r"C:\Users\燕子红\Desktop\123.txt","w",encoding="utf-8") as sb: with open(r"C:\Users\燕子红\Desktop\123.txt","w",encoding="utf-8") as sb:
sb.write("小兰:12本\n") sb.write("小兰:12本\n")
sb.write("小强:12本\n") sb.write("小强:12本\n")
sb.write("李明:15本\n") sb.write("李明:15本\n")
sb.write("小丽: 12本\n")
with open(r"C:\Users\燕子红\Desktop\123.txt","r",encoding="utf-8") as a: with open(r"C:\Users\燕子红\Desktop\123.txt","r",encoding="utf-8") as a:
for date in a: for date in a:
if "小强:12本" in date: if "小强:12本" in date:
date=date.replace("小强:12本","小强:11本)
\ No newline at end of file date=date.replace("小丽:12","小丽:14)
new += bate
\ No newline at end of file
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