Commit 5268fd6c by BellCodeEditor

save project

parent ef1e3235
Showing with 8 additions and 1 deletions
new_data=0
with open(r'C:\Users\qq\Desktop\test.txt','r',encoding='utf-8')as diy: with open(r'C:\Users\qq\Desktop\test.txt','r',encoding='utf-8')as diy:
for data in diy: for data in diy:
if "小兰:12本" in data: if "小兰:12本" in data:
print("在文件中") data=data.replace("小兰:16本","小丽:11本")
new_data=data
with open(r'C:\Users\qq\Desktop\test.txt','w',encoding='utf-8')as diy:
diy.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