import os

import fnmatch

 

for dirPath, dirs, files in os.walk('./'):

    for file_name in files:

        if fnmatch.fnmatch(file_name, '*.m'):

            file_path = dirPath + '/' + file_name

            with open(file_path, 'r') as f:

                for line in f:

                    if 'ABC' in line:

                        print(line)

posted on 2020-11-17 17:11  ximenchuixie  阅读(143)  评论(0编辑  收藏  举报