Commit 677203b1 by BellCodeEditor

save project

parent 1a083e73
Showing with 2 additions and 1 deletions
...@@ -7,6 +7,6 @@ with open(r'C:\Users\Administrator\Desktop\book.txt','a',encoding='utf-8') as fi ...@@ -7,6 +7,6 @@ with open(r'C:\Users\Administrator\Desktop\book.txt','a',encoding='utf-8') as fi
file.write('李强,10本\n') file.write('李强,10本\n')
with open(r'C:\Users\Administrator\Desktop\book.txt','r',encoding='utf-8') as file: with open(r'C:\Users\Administrator\Desktop\book.txt','r',encoding='utf-8') as file:
for data in file1: for data in file:
if '李强,10本'in data: if '李强,10本'in data:
print('数据在文件中') 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