Commit b3e781e5 by BellCodeEditor

save project

parent 9e94f6a5
Showing with 5 additions and 3 deletions
...@@ -6,8 +6,9 @@ ...@@ -6,8 +6,9 @@
# abc.write('小强:12本\n') # abc.write('小强:12本\n')
# abc.write('李明:15本\n') # abc.write('李明:15本\n')
with open(r'C:\Users\我的电脑\Desktop\text.txt','r',encoding='utf-8')as abc: with open(r'C:\Users\我的电脑\Desktop\text.txt','r',encoding='utf-8')as abc:
a=abc.read() for a in abc:
if "小强:12本" in a: if "小强:12本" in a:
abc=abc.replace('小强:12本','小强:11本') a=a.replace('小强:12本','小强:11本')
print(a)
\ 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