Commit e9b26698 by BellCodeEditor

save project

parent b3fcd1b2
Showing with 13 additions and 2 deletions
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本'
with open(r'C:\Users\Administrator\Desktop\222.txt','w',encoding='utf-8') as 222:
222.write('小兰:12本')
#with open(r'C:\Users\Administrator\Desktop\yy.txt','a',encoding='utf-8') as yy:
#yy.write('小兰:12本\n')
#yy.write('小丽:11本\n')
#yy.write('李文:9本\n')
w=''
with open(r'C:\Users\Administrator\Desktop\yy.txt','r',encoding='utf-8') as yy:
for date in yy:
if '小丽:11本' in date:
date=date.replace('小丽:11本','小丽:10本')
w+=date
with open(r'C:\Users\Administrator\Desktop\yy.txt','w',encoding='utf-8') as yy:
yy.write(w)
\ No newline at end of file
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