From 612d34268df5de28b3e77fbd9400e0b0e76b5fb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E5=A4=A9=E5=A7=BF?= Date: Thu, 9 Jul 2020 03:18:25 +0800 Subject: [PATCH] object --- MindSpore/src/step4/object.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 MindSpore/src/step4/object.py diff --git a/MindSpore/src/step4/object.py b/MindSpore/src/step4/object.py new file mode 100644 index 0000000..7c17ed5 --- /dev/null +++ b/MindSpore/src/step4/object.py @@ -0,0 +1,21 @@ +# coding:utf-8 +import re + + +def objectFind(objs, filepath): + n = len(objs) + with open(filepath, 'r') as f: + for line in f.readlines(): + for item in objs: + if(line.replace(" ", "").startswith(item)): + n = n-1 + objs.remove(item) + #print(line) + continue + f.close() + #print("n = {}".format( n)) + if n == 0: + return True + else: + print(objs) + return False