Commit f1b8bb13 by BellCodeEditor

save project

parent dd3b63ef
Showing with 14 additions and 4 deletions
...@@ -7,12 +7,22 @@ ...@@ -7,12 +7,22 @@
#b.close() #b.close()
#b=open(r'D:\桌面\text.txt','a',encoding='utf-8') #b=open(r'D:\桌面\text.txt','a',encoding='utf-8')
#b.write('强:12本\n') #b.write('强:12本\n')
#b.write('李明轩:15本\n') # b.write('李明轩:15本\n')
#b.close() # b.close()
with open(r'D:\桌面\text.txt','w',encoding='utf-8') as b: with open(r'D:\桌面\text.txt','w',encoding='utf-8') as b:
b.write('兰:12本\n') b.write('兰:12本\n')
b.write('丽:11本\n') b.write('丽:11本\n')
b.write('李:9本\n') b.write('李:9本\n')
b.write('张:16本\n') b.write('张:16本\n')
b.write('强:12本\n') b.write('强:12本\n')
b.write('李明轩:15本\n') b.write('李明轩:15本\n')
\ No newline at end of file with open(r'D:\桌面\text.txt','r',encoding='utf-8') as b:
for a in b:
if '强:10本' in b:
print("在")
else:
print("不在")
if '兰:12本' in b:
print("在")
else:
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