Commit add096f7 by BellCodeEditor

save project

parent 4c4f15ce
Showing with 8 additions and 4 deletions
......@@ -5,10 +5,14 @@
# with open("C:\\Users\\111\\Desktop\\file.txt","a",encoding="utf-8") as sue:
# sue.write("\n小强:12本\n李明:15本\n")
str = ""
with open("C:\\Users\\111\\Desktop\\file.txt","r",encoding="utf-8") as sue:
for i in sue:
if "小强:12本" in i:
print("小强在这里")
i = i.replace("小强:12本","小强:11本")
if "小兰:12本" in i:
print("小兰在这里")
\ No newline at end of file
i = i.replace("小兰:12本","小兰:14本")
str += i
with open("C:\\Users\\111\\Desktop\\file.txt","w",encoding="utf-8") as sue:
sue.write(str)
\ 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