Commit 7878cfe9 by BellCodeEditor

save project

parent 473f7e39
Showing with 12 additions and 7 deletions
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'''、'张伟:16本' # 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'''、'张伟:16本'
#b=open(r'C:\Users\Windows 7\Desktop\12.txt','a',encoding='utf-8') # b=open(r'C:\Users\Windows 7\Desktop\12.txt','w',encoding='utf-8')
#b.write('小兰:12本') # b.write('小兰:12本\n')
#b.write('小强:10本\n') # b.write('小强:10本\n')
#b.write('李强:15本\n') # b.write('李强:15本\n')
#b.close() # b.close()
with open(r'C:\Users\Windows 7\Desktop\12.txt','r',encoding='utf-8')as b: with open(r'C:\Users\Windows 7\Desktop\12.txt','r',encoding='utf-8')as b:
d=''
#b.write('小丽:11本\n') #b.write('小丽:11本\n')
#b.write('张伟:16本\n') #b.write('张伟:16本\n')
#a=b.read() #a=b.read()
#print(a) #print(a)
for i in b: for i in b:
if '小强:10本' in i: if '小强:10本' in i:
print('已查找到数据') i=i.replace('小强:10本','小强:15本')
\ No newline at end of file d+=i
print(d)
#print('已查找到数据')
\ 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