Commit 01628335 by BellCodeEditor

save project

parent 3e847f89
Showing with 3 additions and 23 deletions
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本'
files=open(r'E:/康浩乐/text.txt','w',encoding='utf-8')
files.write('3\n')
files.write('2\n')
files.write('4\n')
files.close()
files=open(r'E:/康浩乐/text.txt','r',encoding='utf-8')
p=files.read()
print(p)
a=""
files=open(r'E:/康浩乐/text.txt','r',encoding='utf-8')
for i in files:
if '3' in i:
i=i.replace('3','5')
if '2' in i:
i=i.replace('2','6')
a+=i
files=open(r'E:/康浩乐/text.txt','w',encoding='utf-8')
files.write(a)
files.close()
files=open(r'E:/康浩乐/text.txt','r',encoding='utf-8')
w=files.read()
print(w)
\ No newline at end of file
files=open(r'/Users/xuyz/Desktop/康浩乐/文档,PPT/文档/text.txt','w',encoding='utf-8')
files.write('12345677654321\n123456')
\ 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