Commit 85ab7ed5 by BellCodeEditor

save project

parent 49d6972e
Showing with 4 additions and 3 deletions
...@@ -6,9 +6,9 @@ with open(r'C:\Users\Administrator\Desktop\text.txt','a',encoding='utf-8')as fil ...@@ -6,9 +6,9 @@ with open(r'C:\Users\Administrator\Desktop\text.txt','a',encoding='utf-8')as fil
file1.write('小强:12本\n') file1.write('小强:12本\n')
file1.write('李明:15本\n') file1.write('李明:15本\n')
with open(r'C:\Users\Administrator\Desktop\text.txt','r',encoding='utf-8')as file1: with open(r'C:\Users\Administrator\Desktop\text.txt','r',encoding='utf-8')as file1:
for i in file1: for data in file1:
if'小兰:12本'in i: if'小兰:12本'in data:
print("有") print("有")
if'小强:12本'in i: if'小强:12本'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