Commit 73cce330 by BellCodeEditor

save project

parent 8678808b
Showing with 8 additions and 4 deletions
......@@ -11,10 +11,13 @@
#with open(r"C:\Users\LX\Desktop\book.txt","r",encoding="utf-8") as a:
# b=a.read()
# print(b)
c=""
with open(r"C:\Users\LX\Desktop\book.txt","r",encoding="utf-8") as a:
for i in a:
if '小强:12本'in i:
print("小强有")
if '小兰:12本'in i:
print("小兰有")
if '小强:12本' in i:
i=i.replace('小强:12本','小强:11本')
c+=i
with open(r"C:\Users\LX\Desktop\book.txt","w",encoding="utf-8") as a:
a.write(c)
\ 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