Commit 04f1614c by BellCodeEditor

save project

parent 3d19b130
Showing with 15 additions and 5 deletions
f=open(r'C:\Users\Administrator\Desktop\tt.txt','w',encoding='utf-8')
f.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本\n')
f=open(r'C:\Users\Administrator\Desktop\tt.txt','w',encoding='utf-8')
#a=f.read()
#print(a)
for i in f:
if'小强:10本'in i:
print("y")
\ No newline at end of file
# 写入同学们的捐赠明细:'小兰:12本'、'小丽:11本'、'李文:9本'、'张伟:16本'
#f=open(r'C:\Users\Administrator\Desktop\新建文件夹t.txt','w',encoding='utf-8')
#f.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本\n')
# f.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本\n')
#f.close()
with open(r'C:\Users\Administrator\Desktop\新建文件夹t.txt','w',encoding='utf-8') as f:
with open(r'C:\Users\Administrator\Desktop\tt.txt','w',encoding='utf-8') as f:
f.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本\n')
with open(r'C:\Users\Administrator\Desktop\新建文件夹t.txt','a',encoding='utf-8') as f:
f.write('小强:10本\n:15本\n')
with open(r'C:\Users\Administrator\Desktop\tt.txt','a',encoding='utf-8') as f:
f.write('小强:10本\n:15本\n')
with open(r'C:\Users\Administrator\Desktop\新建文件夹t.txt','r',encoding='utf-8') as f:
with open(r'C:\Users\Administrator\Desktop\tt.txt','r',encoding='utf-8') as f:
a=f.read()
print(a)
\ 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