Commit 2e2697aa by BellCodeEditor

save project

parent a8d02629
Showing with 12 additions and 0 deletions
new_data=''
with open(r'C:\Users\EDZ\Documents\lesson12-2\text.txt','r',encoding='UTF-8') as file:
for data in file:
if '烦得很:12' in data:
data.replace('烦得很:12本','烦得很:999')
new_data+=data
with open(r'C:\Users\EDZ\Documents\lesson12-2\text.txt','w',encoding='UTF-8') as file:
file.write(new_data)
\ No newline at end of file
烦得很:12本
房东电话:1000000本
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