Commit 0a740f26 by BellCodeEditor

save project

parent 3fac3ca1
Showing with 4 additions and 4 deletions
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
# file.write('小强:10本\n') # file.write('小强:10本\n')
# file.write('李明:15本\n') # file.write('李明:15本\n')
with open(r'C:\Users\86130\Desktop\text.txt','r',encoding='UTF-8')as file: with open(r'C:\Users\86130\Desktop\text.txt','r',encoding='UTF-8')as file:
a=file.read() for data in file:
if '小强:10本'in a: if '小强:10本'in data:
print("找到数据") data=data.replace('小强:10本','小强:11本')
print(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