文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
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()
相关阅读 更多 +
排行榜 更多 +
实时多人坦克

实时多人坦克

飞行射击 下载
军团史诗战争

军团史诗战争

飞行射击 下载
极速狂野飞车漂移

极速狂野飞车漂移

飞行射击 下载