Commit 9cada216 by BellCodeEditor

auto save

parent 4b6f2a52
Showing with 8 additions and 4 deletions
...@@ -2,6 +2,11 @@ ...@@ -2,6 +2,11 @@
# file = open('D:/data.txt','w',encoding='utf-8') # file = open('D:/data.txt','w',encoding='utf-8')
# file.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本\n') # file.write('小兰:12本\n小丽:11本\n李文:9本\n张伟:16本\n')
# file.close() # file.close()
with open('d:/data.txt','a',encoding='utf-8') as file: # with open('d:/data.txt','a',encoding='utf-8') as file:
file.write('小强:20本') # file.write('小强:20本')
with open('d:/data.txt','r',encoding='utf-8') as file:
\ No newline at end of file for data in file:
if '小强:20本' in data:
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