当前位置: 首页 > 后端技术 > Python

使用python将html转为markdown

时间:2023-03-26 15:00:18 Python

importhtml2textashttext_maker=ht.HTML2Text()#读取html格式文件withopen('./*.html','r',encoding='UTF-8')asf:htmlpage=f.read()#处理html格式文件中的内容text=text_maker.handle(htmlpage)#把处理后的内容用open('*.md','w')写成f:f。写(文字)