Commit 40a82422 by BellCodeEditor

save project

parent 4496b258
Showing with 5 additions and 3 deletions
...@@ -5,8 +5,9 @@ file.write('小丽:11本\n') ...@@ -5,8 +5,9 @@ file.write('小丽:11本\n')
file.write('李文:9本\n') file.write('李文:9本\n')
file.write('张伟:16本\n') file.write('张伟:16本\n')
file.close() file.close()
with open('C:\\Users\\Administrator\\Desktop\\text.txt','a',encoding='utf-8') as file: with open('C:\\Users\\Administrator\\Desktop\\text.txt','r',encoding='utf-8') as file:
file.write('小兰:12本\n') for data in file:
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