阅读背景:

使用Python将HTML文档转换为Markdown文档_peiwang245的博客_html转markdown python

来源:互联网 
import html2text as ht  # pip install html2text

text_maker = ht.HTML2Text()
text_maker.bypass_tables = False
htmlfile = requests.get(npurl)#网页网址
htmlfile.encoding = 'gbk'
htmlpage = htmlfile.text
text = text_maker.handle(htmlpage)
md = text.split('#')import html2text as ht  # pip install html2text



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: