如何从 python 文件将本地 HTML 文件打开到浏览器中?要读取本地 html 内容,请使用 lxml.html 和 open(): from lxml import html with open('test.html','r',encoding='utf-8') as f: text = html.fromstring(f.read()) AI悦创原创...大约 1 分钟Python 小技巧Python 小技巧