Commit 9ac283e1 by BellCodeEditor

save project

parent 1dbf3a01
Showing with 4 additions and 2 deletions
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
with open(r"C:\Users\Administrator\Desktop\book.txt",'r',encoding='utf-8')as filel: with open(r"C:\Users\Administrator\Desktop\book.txt",'r',encoding='utf-8')as filel:
for data in filel: for data in filel:
if '小强:10本'in data: if '小强:10本'in data:
print('小强的数据在文件中') data =data.replace('小强:10本','小强:11本')
if '小兰:12本'in data: if '小兰:12本'in data:
print('小兰的数据在文件中') data =data.replace('小兰:12本','小兰:14本')
new_data +=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