python反编译chm文件并生成pdf文件

python反编译chm文件并生成pdf文件

2023年7月3日发(作者:)

python反编译chm⽂件并⽣成pdf⽂件

1 # -*- coding: utf-8 -*- 2

3 import os 4 import 5 import logging 6 import pdfkit 7

8 original_chm = r'C:' 9 root_dir = r'C:UsershushaojunDocumentscanoeHelp01canoeTopics'10 seperator = 11

12 # -decompile <输出路径> <⽬标chm⽂件>13

14 onfig(level=G,15 format='%(asctime)s %(pathname)s %(filename)s %(funcName)s [line:%(lineno)d] %(levelname)s %(message)s',16 datefmt='%Y-%m-%d %H:%M:%S',17 filename='all_file_',18 filemode='w+')19

20 #深度优先算法21 def recursionFunction(level, path):22 for file_content in r(path): #列举显⽰所有⽂件夹下的内容23 #“-”⽤于显⽰⽬录层次结构24 full_path_name = (path, file_content)25 print('-'*(level+1) + full_path_name)26

27 if (full_path_name): #如果是⽂件夹就递归显⽰28 recursionFunction(level+1, full_path_name)29 else: #如果是⽂件那就要直接显⽰30 (shotname, extension) = xt(file_content)31

32 ('⽂件全名为:' + full_path_name)33 print('⽂件名为:' + shotname)34 print('⽂件后缀名为:' + extension)35

36 pdf_file_name = (path, shotname + '.pdf')37

38 if (not (pdf_file_name)) and ((extension == '.htm') or (extension == '.html')):39 try:40 _file(full_path_name, pdf_file_name)41 except OSError:42 print('just skip!')43 except Exception as e:44 print(type(e))45

46 if __name__ == '__main__':47 decomplile_cmd = ' -decompile %s %s' % (root_dir, original_chm)48 (decomplile_cmd)49 recursionFunction(0, root_dir)

发布者:admin,转转请注明出处:http://www.yc00.com/xiaochengxu/1688384683a130033.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信