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

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

相关推荐
Q_Q5110082854 分钟前
python+uniapp基于微信小程序的垃圾分类信息系统
spring boot·python·微信小程序·django·flask·uni-app·node.js
HackerTom6 分钟前
vs code jupyter连gpu结点kernel
python·jupyter·gpu·vs code·远程
longerxin20209 分钟前
ubuntu所有版本镜像下载链接
linux·运维·ubuntu
数据雕塑家16 分钟前
Linux下的花式「隔空」文件传输魔法
linux·运维·服务器
uoscn22 分钟前
链接脚本(Linker Scripts)
linux·arm开发·arm
weixin_468466851 小时前
遗传算法求解TSP旅行商问题python代码实战
python·算法·算法优化·遗传算法·旅行商问题·智能优化·np问题
橘子真甜~1 小时前
C/C++ Linux网络编程2 - Socket编程与简单UDP服务器客户端
linux·运维·服务器·网络编程api·udp协议·udp通信
Nina_7171 小时前
pytorch核心组件以及流程
人工智能·pytorch·python
Highcharts.js2 小时前
在Python中配置高度交互的数据可视化:Highcharts完全指南
开发语言·python·信息可视化·highcharts
Ace_31750887762 小时前
京东关键字搜索接口逆向:从动态签名破解到分布式请求调度
分布式·python