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

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

相关推荐
m0_748920363 分钟前
Oracle默认端口被占用如何连接_修改端口号操作教程
jvm·数据库·python
YummyJacky4 分钟前
Hermes Agent自进化的实现方式
人工智能·python
qq_3422958210 分钟前
Redis怎样按照距离远近排序展示_通过GEORADIUS的ASC参数进行Geo排序
jvm·数据库·python
2201_7610405916 分钟前
C#比较两个二进制文件的差异 C#如何实现一个二进制diff工具
jvm·数据库·python
Csvn24 分钟前
🌟 LangChain 30 天保姆级教程 · Day 23|Agent 进阶实战!Function Calling + 自动 Tool 注册,打造会“动
python·langchain
Csvn24 分钟前
🌟 LangChain 30 天保姆级教程 · Day 22|长文档处理三剑客!MapReduce、Refine、Map-Rerank,让 AI 消化整本手册
python·langchain
John.Lewis36 分钟前
Python小课(1)认识Python
开发语言·python
Polar__Star37 分钟前
SQL中如何实现特定顺序的查询:CASE WHEN自定义排序
jvm·数据库·python
u0109147601 小时前
mysql如何配置监听IP_mysql bind-address多地址设置
jvm·数据库·python
a9511416421 小时前
如何配置RMAN使用第三方备份软件接口_NetBackup或Commvault的MML层整合
jvm·数据库·python