diff --git a/common/file.py b/common/file.py index 22e51f894c5ab644fd70da2be97017af12b53d98..2184699d90d05ca56f05d571f30556fb157ca688 100644 --- a/common/file.py +++ b/common/file.py @@ -67,3 +67,14 @@ class FileOperation: return True else: return False + + @staticmethod + def get_str_num_in_file(file_name, dist_str): + i = 1 + dist_list = [] + with io.open(file_name,'r') as file: + for item in file.readlines(): + if dist_str in str(item): + dist_list.append(i) + i = i + 1 + return dist_list