Commit a01b8b26 by BellCodeEditor

save project

parent 473b8977
Showing with 11 additions and 4 deletions
......@@ -5,10 +5,17 @@
# file1=open(r'C:\Users\Administrator\Desktop\text.txt','a',encoding='UTF-8')
# file1.write('小强:12本\n')
# file1.write('李明:15本\n')
# file1.close()
with open(r'C:\Users\Administrator\Desktop\text.txt','a',encoding='UTF-8')as file:
file.write('小强:12本\n')
file.write('李明:15本\n')
file1.close()
# with open(r'C:\Users\Administrator\Desktop\text.txt','a',encoding='UTF-8')as file:
# file.write('小强:12本\n')
# file.write('李明:15本\n')
with open(r'C:\Users\Administrator\Desktop\text.txt','r',encoding='UTF-8')as file:
a=file.read()
if '小强:10本' in a:
print('找到数据')
if '小兰:12本' in a:
print('找到数据')
......
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