Commit a4fffaab by BellCodeEditor

save project

parent 6b322b7c
Showing with 15 additions and 0 deletions
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本'
new_date=''
with open(r'D:\桌面\text.txt','w',encoding='utf-8') as file:
file.write('消杀:11本\n')
with open(r'D:\桌面\text.txt','r',encoding='utf-8') as file:
#r=file1.read()
#print(r)
for date in file:
if "消杀:11本" in date:
date=date.replace("消杀:11本","小傻:12笨")
print(date)
new_date +=date
with open(r'D:\桌面\text.txt','w',encoding='utf-8') as file:
file.write(new_date)
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