Commit 1920f634 by BellCodeEditor

auto save

parent c2c543ab
Showing with 12 additions and 0 deletions
new_data= ""
with open(r"C:\Users\MC3-06\Desktop\tt.txt","r",encoding="utf-8") as tdfgrv:
for data in tdfgrv:
if "小兰:12" in data:
data = data.replace("小兰:12", "小兰:11")
new_data += data
print(new_data)
with open(r"C:\Users\MC3-06\Desktop\tt.txt", "w",encoding="utf-8") as tdfgrv2:
tdfgrv2.write(new_data)
# tdfgrv.write("小兰:12\n小强:10\n李明:15" )
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