Commit 38d38bf0 by BellCodeEditor

save project

parent c84d2686
Showing with 7 additions and 4 deletions
...@@ -5,6 +5,9 @@ ...@@ -5,6 +5,9 @@
#file1.write('李文:9本\n') #file1.write('李文:9本\n')
#file1.write('张伟:16本\n') #file1.write('张伟:16本\n')
#file1.close() #file1.close()
with open(r'C:\Users\dell\Desktop\新建文本文档.txt','a',encoding='utf-8') as file: with open(r'C:\Users\dell\Desktop\新建文本文档.txt','r',encoding='utf-8') as file1:
file.write('小强:10本\n') for data in file1:
file.write('李明:15本\n') if'小强:10本' in data:
\ No newline at end of file print("小强的数据在文件中")
if'小兰:12本' in data:
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