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")

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

相关推荐
qeen878 分钟前
【Linux】操作系统之进程介绍(二)
linux·笔记·学习·进程
Zenova EdgeOS19 分钟前
Linux ss 工业边缘网络分析实战
linux·python·边缘计算·工业网关
第十人i19 分钟前
Linux 日志管理系统:journald 配置与优化
linux·服务器
wuminyu22 分钟前
HotSpot的轻量锁与膨胀后的ObjectMonitor状态重建原理
java·linux·c语言·jvm·c++
成为深度学习高手33 分钟前
CrossLinear:即插即用的跨相关嵌入,让线性模型也能用好外生变量
人工智能·python·深度学习·数据挖掘
陈年老古董1 小时前
MediaPipe 姿态检测与脸部关键点检测
笔记·python·opencv·学习·dlib
伞伞悦读1 小时前
【第37期】Python JSON 与配置详解:序列化、反序列化、嵌套结构和配置文件
开发语言·python·json
Ticnix1 小时前
42 天 71 次提交之后,我重新看了一遍自己的架构决策
python·agent·全栈
CCCCCCCCharlie1 小时前
Linux进程控制四大核心操作
linux·开发语言
Ticnix1 小时前
我调了三个月 overlap=50,它其实一次都没生效
后端·python·agent