python 使用editplus.exe 打开所有指定文件

复制代码
# install beautifulsoup4
import os
import re
import chardet
import requests
import subprocess
from bs4 import BeautifulSoup

def IsArrayEmpty(list):
	return not list	

def ReadFile(strFilePath):#读取文件
	with open(strFilePath, 'rb') as f:
		varContent = f.read()
		encoding = chardet.detect(varContent)['encoding']
		varContent = varContent.decode(encoding)
		return varContent
	return ""

def ParseFile(path, strSearch):
	strData = ReadFile(path)
	nIndex = strData.find(strSearch)
	if nIndex != -1:
		editplus_path = "C:\\Program Files\\EditPlus\\editplus.exe"
		if os.path.isfile(path):
			#将文件的打开方式设定为EditPlus
			#将Editplus.exe 打开所有文件
			os.startfile(path)
			
def enumerate_folder(strFolder, strSearch):
    for root, dirs, files in os.walk(strFolder):
        for file in files:	
            path = os.path.join(root, file)	
            if path.find(".py") == -1:
                ParseFile(path, strSearch)
            else:
                print(path)
        for dir in dirs:
            pass		

enumerate_folder("./", "elecbook")

根据指定字符串查找到文档

相关推荐
东莞市云毅网络有限公司7 分钟前
AI 引用句逐条回指原文:让回答可回溯的校验实现
python·数据清洗·rag·企业知识库·文档解析
数字融合2 小时前
透明化视频三维矿山井下照明重建技术
人工智能·python·数码相机
yi0112 小时前
LeetCode 219:存在重复元素 II——哈希表记录“最近一次出现的位置”
数据结构·人工智能·笔记·python·算法·leetcode·哈希表
_upupup3 小时前
Linux的调试工具——gdb/cgdb
linux·服务器
JeJe同学3 小时前
Docker镜像导入、容器启动
linux·运维·docker
Jason_zhao_MR3 小时前
Linux与实时控制如何兼得
linux·嵌入式硬件·机器人·工业控制
Marst Code3 小时前
上位机开发日记 · 第 2 篇 · 架构先行:六层分层与边界
python
闲云野鹤在人间4 小时前
MySQL|从理论、安装、备份到主从复制、MHA高可用详解
linux·运维·数据库·mysql·云计算
李日华大战鸡红4 小时前
FOC状态空间方程模型推导(学习记录)
python·学习·线性代数
一个风轻云淡5 小时前
GCC 和 GDB命令简单解读
java·linux·前端