Commit cb74cc2d by BellCodeEditor

save project

parent 04f1614c
Showing with 16 additions and 10 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')
f=open(r'C:\Users\Administrator\Desktop\t.txt','w',encoding='utf-8')
f.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本\n')
f=open(r'C:\Users\Administrator\Desktop\t.txt','r',encoding='utf-8')
#a=f.read()
#print(a)
for i in f:
if'小强:10本'in i:
print("y")
\ No newline at end of file
for i in f:
if'小兰:12本'in i:
print("yes")
f.close()
\ No newline at end of file
......@@ -2,11 +2,15 @@
#f=open(r'C:\Users\Administrator\Desktop\新建文件夹t.txt','w',encoding='utf-8')
# f.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本\n')
#f.close()
with open(r'C:\Users\Administrator\Desktop\tt.txt','w',encoding='utf-8') as f:
with open(r'C:\Users\Administrator\Desktop\t.txt','w',encoding='utf-8') as f:
f.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本\n')
with open(r'C:\Users\Administrator\Desktop\tt.txt','a',encoding='utf-8') as f:
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','r',encoding='utf-8') as f:
with open(r'C:\Users\Administrator\Desktop\t.txt','r',encoding='utf-8') as f:
a=f.read()
print(a)
#for i in f:
#if'小兰:12本'in i:
#print("yes")
f.close()
\ 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