Commit 5dfe7964 by BellCodeEditor

auto save

parent 8978ab50
Showing with 8 additions and 3 deletions
...@@ -13,8 +13,13 @@ with open(r'E:\demo\books.txt','a',encoding='utf-8') as file1: ...@@ -13,8 +13,13 @@ with open(r'E:\demo\books.txt','a',encoding='utf-8') as file1:
file1.write('喜羊洋:1010本\n') file1.write('喜羊洋:1010本\n')
data=''
with open(r'E:\demo\books.txt','r',encoding='utf-8') as file1: with open(r'E:\demo\books.txt','r',encoding='utf-8') as file1:
for i in file1: for i in file1:
if "小力:11本" in i: if "小兰:12本" in i:
print("存在的") i=i.replace('小兰:12本','小兰:22本')
data+=i
with open(r'E:\demo\books.txt','w',encoding='utf-8') as file1:
file1.write(data)
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