Commit 878f0d79 by BellCodeEditor

save project

parent 28461b17
Showing with 7 additions and 2 deletions
...@@ -7,7 +7,12 @@ ...@@ -7,7 +7,12 @@
# w.write('小兰:12本\n') # w.write('小兰:12本\n')
# w.write('小强:12本\n') # w.write('小强:12本\n')
# w.write('李明: 15本\n') # w.write('李明: 15本\n')
k_=''
with open(r'D:\桌面\text.txt','r',encoding='utf-8') as w: with open(r'D:\桌面\text.txt','r',encoding='utf-8') as w:
for k in w: for k in w:
if '小强:10本' in k: if '小强:10本' in k:
print('数据在文件中') k=k.replace('小强:10本','小强:11本')
k_+=k
print(k_)
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