Commit af03ae2d by BellCodeEditor

auto save

parent 92e7b7d2
Showing with 23 additions and 7 deletions
# aaa=open(r'C:\Users\Administrator\Desktop\yy.txt','r',encoding='utf-8')
# for i in aaa: # aaa=open(r'C:\Users\Administrator\Desktop\yy.txt','w',encoding='utf-8')
# if "小强:10本" in i: # aaa.write("小强:10本\n")
# print("有小强数据") # aaa.write("小明:10本\n")
srt.replace("小强:10本","小强:11本") # aaa.write("小蓝:10本\n")
srt.replace("小蓝:10本","小蓝:14本") # aaa.close()
\ No newline at end of file aaa=open(r'C:\Users\Administrator\Desktop\yy.txt','r',encoding='utf-8')
new_data=""
for i in aaa:
if "小强:10本" in i:
i = i.replace("小强:10本","小强:11本")
new_data+= i
aaa.close()
aaa=open(r'C:\Users\Administrator\Desktop\yy.txt','w',encoding='utf-8')
aaa.write(new_data)
aaa.close()
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