Commit 52b5a842 by BellCodeEditor

save project

parent 189cc739
Showing with 4 additions and 5 deletions
with open(r'C:\Users\Think\Desktop\新建文件夹\新建文本文档.txt','a',encoding='utf-8') as file: with open(r'C:\Users\Think\Desktop\新建文件夹\新建文本文档.txt','a',encoding='utf-8') as file:
for data in filel: for data in filel:
if '小强: 10本' in data: if '小强: 10本' in data:
print('小强数据在文件中') data=data.replace('小强. 10本','小强. 11本')
if '小名: 15本' in data: if '小兰: 15本' in data:
print('小名数据在文件中') data=data.replace('小强. 12本','小强. 14本')
filel.write(new_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