文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Python的difflib模块HtmlDiff

Python的difflib模块HtmlDiff

时间:2006-11-27  来源:weizhuyu

今天看了下difflib下有个HtmlDiff,看了帮助结果不行,几经周折原来是需要三个参数(HtmlDiff(), text1, text2),写下来以备忘记:

text1=[' 1. Beautiful is better than ugly.\n', ' | ... 2. Explicit is better than implicit.\n', ' | ... 3. Simple is better than complex.\n', ' | ... 4. Complex is better than complicated.\n', ' | ... ']
text2=[' 1. Beautiful is better than ugly.\n', ' | ... 3. Simple is better than complex.\n', ' | ... 4. Complicated is better than complex.\n', ' | ... 5. Flat is better than nested.\n', ' | ... ']
from difflib import *
s = HtmlDiff.make_file(HtmlDiff(),text1,text2)
f=open(r"c:\compareresult.html",'w')
f.write(s)
f.close()
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载