Commit 8558af45 by BellCodeEditor

save project

parent 7b11bddd
Showing with 4 additions and 4 deletions
...@@ -8,6 +8,7 @@ new_data="" ...@@ -8,6 +8,7 @@ new_data=""
with open(r'C:\Users\Administrator\Desktop\text.txt','r',encoding='utf-8')as file1: with open(r'C:\Users\Administrator\Desktop\text.txt','r',encoding='utf-8')as file1:
for data in file1: for data in file1:
if '刘强:15本' in data: if '刘强:15本' in data:
data.replace("刘强:15本","刘强:10本") data=data.replace("刘强:15本","刘强:10本")
new_data=data new_data+=data
print(new_data) with open(r'C:\Users\Administrator\Desktop\text.txt','w',encoding='utf-8')as file1:
\ No newline at end of file print(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