Commit b5a66bad by BellCodeEditor

save project

parent a8d02629
Showing with 16 additions and 0 deletions
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本'
filel=open(r"C:\Users\EDZ\Desktop\dsbzbw.txt","w",encoding="utf-8")
filel.write("小兰:12本")
filel.write("小丽:11本")
filel.write("李文:9本")
filel.write("张伟:16本")
filel.close()
with open(r"C:\Users\EDZ\Desktop\dsbzbw.txt","a",encoding="utf-8") as file2:
file2.write("d兰:2000本")
with open(r"C:\Users\EDZ\Desktop\dsbzbw.txt","r",encoding="utf-8") as file3:
for data in file3:
if "张伟:16本" in data:
data=data.replace("张伟:16本","张伟:191626868368628632636238326826362836863826836283682368268263826836826864287834274946520653098436450643659432803604868546464328640925682652809506520454648508463898977798666986689869996696908608606896969066688986544533563536577367637560290980本")
new_data+=data
with open(r"C:\Users\EDZ\Desktop\dsbzbw.txt","r",encoding="utf-8") as file4:
file4.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