python 读取 chm 格式文件

创建日期: 2023-08-04 19:26 | 作者: 风波 | 浏览次数: 14 | 分类: Python

安装 pychm

yum install -y chmlib-devel
pip install pychm
pip install BeautifulSoup4

读取 chm 文件

来源:https://stackoverflow.com/questions/8645650/processing-chm-files

import chm.chm as chm
from bs4 import BeautifulSoup

chmfile = chm.CHMFile()
chmfile.LoadCHM(file_name)

iui = chmfile.ResolveObject(chmfile.home)
home = self.chmfile.RetrieveObject(iui[1])[1] # get home page (as html)
tree = BeautifulSoup(home)
14 浏览
11 爬虫
0 评论