search_tool_main.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:Mac-Python-3.X 作者: L1nwatch 项目源码 文件源码
def begin_search(self, root_path, file_type, ignore_case, keyword):
        counts = 0
        for root, dirs, files in os.walk(root_path):
            for each_file in files:
                if is_valid_file_type(each_file, file_type):
                    path = root + os.sep + each_file
                    line_content = search_keyword_infile(path, keyword, ignore_case)
                    if line_content:
                        self.result_table.insertRow(counts)

                        content_path = QTableWidgetItem(".{}".format(path[len(root_path):]))
                        self.result_table.setItem(counts, 0, content_path)

                        content = QTableWidgetItem(line_content.strip())
                        self.result_table.setItem(counts, 1, content)

                        counts += 1
                        self.result_table.setRowCount(counts)

        self.state_label.setText("????")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号