python - 比较两个字符串并并排返回python中html中两个字符串之间的差异
问题描述
现在我difflib
在 Python 中使用来生成不同的 html,
import difflib
htmlcontent =
difflib.HtmlDiff(wrapcolumn=60).make_file(
file_1, file_2, old_file.name, new_file,context=True)
with open(output_file, "w", encoding="utf8", errors='ignore') as f:
f.write(htmlcontent)
问题 UI 不吸引人(UI 将根据 diff 从 html 文件呈现)。任何使 UI 更具吸引力的建议。或任何其他 python 库是否可以返回包含具有吸引力 UI 的差异的 html 模板,例如在线差异检查器?
解决方案
推荐阅读
- mysql - 从命令行优化 MySQL 查询
- flutter - 是否可以在颤振应用程序中打开网页?
- javascript - 我想用 nodejs(js) 任何文档操作 xls 文件而不是 xlsx
- reactjs - Azure AD 身份验证 - NextJS
- python - Python:如何将 Pandas Dataframe 行值转换为单个列?
- tfs - 如何通过测试和反馈扩展捕获自定义工作项类型的错误类别?
- c# - ASP.NET Core LinkGenerator 和编译时间检查
- web-applications - 如何通过 LAN 为 Web 应用程序执行 Web 推送
- javascript - 如何在javascript中选择选项?
- kettle - Penthao Kettle:如何在我的转换中应用查询超时