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

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

相关推荐
掘金者说3 分钟前
【SQLite】设置本地时间戳默认值
linux·数据库·sqlite
fareast_mzh4 分钟前
libevent TCP echo
linux·网络协议·tcp/ip
mofei1213814 分钟前
Python设计模式 - 原型模式
python·设计模式·原型模式
m0_7482371517 分钟前
【玩转全栈】----Django制作部门管理页面
后端·python·django
一张假钞20 分钟前
spacemacs gnuplot
linux·emacs
栗筝i21 分钟前
Spring 核心技术解析【纯干货版】- XI:Spring 数据访问模块 Spring-Oxm 模块精讲
数据库·python·spring
邹霍梁@开源软件GoodERP1 小时前
《手札·开源篇》基于开源Odoo软件与Deepseek的智能企业管理系统集成方案
python·开源
我的运维人生1 小时前
Python在数据科学中的高效应用:从数据处理到模型部署的实战指南
开发语言·python·信息可视化·运维开发·技术共享
c无序1 小时前
Linux提供给我们的定时器
linux·运维·服务器
唐·柯里昂7981 小时前
[开源/教程]使用Ollama+ESP32实现本地对话助手(可接入deepseek等模型)
人工智能·pytorch·python·物联网·语言模型·开源·语音识别