Commit 98417783 by BellCodeEditor

save project

parent 5238422f
Showing with 8 additions and 2 deletions
......@@ -2,4 +2,10 @@ files=open(r'C:\Users\admin\Desktop\test.txt','w',encoding='utf-8')
files.write('小红:18本\n小丽:12本\n李文:9本\n张伟:16本')
files.close()
with open(r'C:\Users\admin\Desktop\test.txt','a',encoding='utf-8') as files:
files.write('小强:12本\n李明:15本')
\ No newline at end of file
files.write('小强:12本\n李明:15本')
with open(r'C:\Users\admin\Desktop\test.txt','r',encoding='utf-8')as files:
for i in files:
if '小强' in i:
print('追踪到了小强')
if '小兰' in i:
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