Commit 53e0fa4a by BellCodeEditor

save project

parent 3e13aa87
Showing with 4 additions and 2 deletions
...@@ -5,6 +5,8 @@ with open(r"C:\Users\Administrator\Desktop\test.txt","a",encoding="utf-8") as fi ...@@ -5,6 +5,8 @@ with open(r"C:\Users\Administrator\Desktop\test.txt","a",encoding="utf-8") as fi
file.write('李明:15本\n') file.write('李明:15本\n')
file.write('小强:10本\n') file.write('小强:10本\n')
file1=open(r"C:\Users\Administrator\Desktop\test.txt","r",encoding="utf-8") file1=open(r"C:\Users\Administrator\Desktop\test.txt","r",encoding="utf-8")
a=file1.read() for date in file1:
print(a) if '小强:10本' in date:
print("找到了")
file1.close() file1.close()
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