Commit 88cf86d2 by BellCodeEditor

save project

parent 899d2567
Showing with 4 additions and 5 deletions
...@@ -2,12 +2,11 @@ ...@@ -2,12 +2,11 @@
#with open(r'C:\Users\Administrator\Desktop\abb.txt','w',encoding='UTF-8') as a: #with open(r'C:\Users\Administrator\Desktop\abb.txt','w',encoding='UTF-8') as a:
# a.write('小兰:12本\n') # a.write('小兰:12本\n')
# a.write('小丽:11本\n') # a.write('小丽:11本\n')
newdata=""
with open(r'C:\Users\Administrator\Desktop\abb.txt','r',encoding='utf-8') as file1: with open(r'C:\Users\Administrator\Desktop\abb.txt','r',encoding='utf-8') as file1:
for data in file1: for data in file1:
if '小丽:11本' in data: if '小丽:11本' in data:
print("数据在文件中") data=data.replace('小丽:11本','小丽:13本')
newdata+=data
print(newdata)
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