Commit cd4e3491 by BellCodeEditor

save project

parent ac76009c
Showing with 7 additions and 7 deletions
...@@ -3,12 +3,12 @@ ...@@ -3,12 +3,12 @@
# file.write("小兰:12本\n") # file.write("小兰:12本\n")
# file.write("小利:11本\n") # file.write("小利:11本\n")
# file.close() # file.close()
a=""
with open(r"C:\Users\丽达7号\Desktop\XM.txt","r",encoding="utf-8")as file: with open(r"C:\Users\丽达7号\Desktop\XM.txt","r",encoding="utf-8")as file:
# file.write("小兰:12本\n")
# file.write("小利:11本\n")
for i in file: for i in file:
if "小兰:12本" in i: if "小兰:12本" in i:
i=i.replace("小兰:12本","小兰:14本") print("XL在里面")
print(9) else:
a=a+i print("XL不在里面")
with open(r"C:\Users\丽达7号\Desktop\XM.txt","w",encoding="utf-8")as file:
file.write(a) \ No newline at end of file
\ 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