Commit cff74b26 by BellCodeEditor

auto save

parent 1dbcff9e
Showing with 3 additions and 13 deletions
......@@ -2,15 +2,5 @@
#a=open("C:\\Users\\Administrator\\Desktop\\book.txt","w",encoding="utf-8")
#a.write('小兰:12本')
#a.close()
with open(r"C:\Users\Administrator\Desktop\book.txt","r",encoding="utf-8") as f:
new=''
for i in f:
if'小兰:12本'in i:
i=i.replace('小兰:12本','小兰:14本')
new=new+i
print(new)
with open(r"C:\Users\Administrator\Desktop\book.txt","w",encoding="utf-8") as f:
f.write(new)
#q.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本')
#str.replace('小兰:12本','小兰:14本')
#str.replace()
\ No newline at end of file
with open("C:\\Users\\Administrator\\Desktop\\book.txt","w",encoding="utf-8") as q:
q.write('小兰:12本\n小丽:11本')
\ 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