From 542e8baf6d9c1472ae9f7662b033b958d6ad91ff Mon Sep 17 00:00:00 2001 From: BellCodeEditor <bellcode_dev@bell.ai> Date: Sat, 5 Mar 2022 12:05:25 +0800 Subject: [PATCH] save project --- 123.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/123.py b/123.py index 5b96fdc..1841c01 100644 --- a/123.py +++ b/123.py @@ -1,3 +1,9 @@ -with open(r'C:\Users\admin\Desktop\book.txt',"a",encoding="utf-8") as file: - file.write('小强:11本\n李明:8本\n') +with open(r'C:\Users\admin\Desktop\book.txt',"r",encoding="utf-8") as file: + for data in file: + if "小兰:12本" in data: + print("在") + if "小强:10本" in data: + print("在") + +# file.write('小强:11本\n李明:8本\n') -- libgit2 0.25.0