Commit c5e0d3f7 by BellCodeEditor

save project

parent eaa03d01
Showing with 6 additions and 15 deletions
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本' 发的 20 26 98 25
with open(r'C:\Users\win 10\Desktop\po.txt','w',encoding='utf-8') as po: 人员 25 20 98 25
#po.write('小兰:12\n') 大润 25 26 97 25
po.write('小强:10\n') 剩下 25 26 98 18
po.write('李明:15\n')
with open(r'C:\Users\win 10\Desktop\po.txt','a',encoding='utf-8') as po:
po.write('小兰:12\n')
new=''
with open(r'C:\Users\win 10\Desktop\po.txt','r',encoding='utf-8') as po:
for d in po:
if '小兰:12' in d:
d=d.replace('小兰:12','小兰:15')
new+=d
with open(r'C:\Users\win 10\Desktop\po.txt','w',encoding='utf-8') as po:
po.write(new)
with open('c:\Users\win 10\Documents\lesson12-1\diy.py','r',encoding='utf-8') as ppp:
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