Commit 5a9e7f4e by BellCodeEditor

save project

parent 49ea9c2c
Showing with 6 additions and 0 deletions
...@@ -10,4 +10,10 @@ file1=open(r"C:\Users\Think\Desktop\bellcode.txt",'a',encoding='UTF-8') ...@@ -10,4 +10,10 @@ file1=open(r"C:\Users\Think\Desktop\bellcode.txt",'a',encoding='UTF-8')
file1.write('小路:14本\n') file1.write('小路:14本\n')
file1.write('张三:4本\n') file1.write('张三:4本\n')
file1.close() file1.close()
with open(r"C:\Users\Think\Desktop\bellcode.txt",'r',encoding='UTF-8') as file1:
for data in file1:
if '张三: 4本' in data:
print("张三数据在文件中")
if '小路:14本' 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