Python论坛  - 讨论区

标题:[python-chinese] 能否推荐一个文本比较的库?

2007年10月25日 星期四 09:27

RO rosettas在gmail.com
星期四 十月 25 09:27:16 HKT 2007

hi all

希望能有获取不同文本比较结果, 并能将结果和旧版本文本合并出新版本文本的功能.

-- 
with kind regards

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月25日 星期四 09:36

Zoom.Quiet zoom.quiet在gmail.com
星期四 十月 25 09:36:42 HKT 2007

On 10/25/07, RO <rosettas在gmail.com> wrote:
> hi all
>
> 希望能有获取不同文本比较结果, 并能将结果和旧版本文本合并出新版本文本的功能.
>
直接调用 diff 好了,标准,稳定,

-- 
'''Time is unimportant, only life important!
过程改进即是开始促生可以产生靠谱的人的组织!
'''http://zoomquiet.org
blog  @ http://blog.zoomquiet.org/pyblosxom/
wiki  @ http://wiki.woodpecker.org.cn/moin/ZoomQuiet
scrap @ http://floss.zoomquiet.org
share @ http://share.zoomquiet.org
douban@ http://www.douban.com/people/zoomq/
好看簿 @ http://zoomq.haokanbu.com/
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Pls. usage OOo to replace M$ Office. http://zh.openoffice.org
Pls. usage 7-zip to replace WinRAR/WinZip.  http://7-zip.org
You can get the truely Freedom 4 software.

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月25日 星期四 09:39

xxmplus xxmplus在gmail.com
星期四 十月 25 09:39:55 HKT 2007

diff

On 10/25/07, RO <rosettas at gmail.com> wrote:
> hi all
>
> 希望能有获取不同文本比较结果, 并能将结果和旧版本文本合并出新版本文本的功能.
>
> --
> with kind regards
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese


-- 
Any complex technology which doesn't come with documentation must be the best
available.

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月25日 星期四 09:54

??? ?? clfff.peter在gmail.com
星期四 十月 25 09:54:24 HKT 2007

ʲôÊÇdiff£¬pythonÖÐÓÐÕâ¸öÄ£¿éÂð£¿

2007/10/25, xxmplus <xxmplus在gmail.com>:
>
> diff
>
> On 10/25/07, RO <rosettas在gmail.com> wrote:
> > hi all
> >
> > Ï£ÍûÄÜÓлñÈ¡²»Í¬Îı¾±È½Ï½á¹û, ²¢Äܽ«½á¹ûºÍ¾É°æ±¾Îı¾ºÏ²¢³öа汾Îı¾µÄ¹¦ÄÜ.
> >
> > --
> > with kind regards
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
> --
> Any complex technology which doesn't come with documentation must be the
> best
> available.
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071025/d6daf964/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月25日 星期四 10:04

xxmplus xxmplus在gmail.com
星期四 十月 25 10:04:34 HKT 2007

sorry I cant type chinese here.

diff (stands for difference) is a file comparison program that gives
you differences between two files. the output of "diff" can be applied
with another program "patch" which does exactly what RO asks for.

diff and patch can be found in most unix/linux system.

On 10/25/07, ??? ?? <clfff.peter at gmail.com> wrote:
> 什么是diff,python中有这个模块吗?
>
>
> 2007/10/25, xxmplus <xxmplus at gmail.com>:
> > diff
> >
> > On 10/25/07, RO <rosettas at gmail.com> wrote:
> > > hi all
> > >
> > > 希望能有获取不同文本比较结果, 并能将结果和旧版本文本合并出新版本文本的功能.
> > >
> > > --
> > > with kind regards
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese at lists.python.cn
> > > Subscribe: send subscribe to
> python-chinese-request at lists.python.cn
> > > Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> > > Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
> >
> >
> > --
> > Any complex technology which doesn't come with documentation must be the
> best
> > available.
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to
> python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> > Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to
> python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to
> python-chinese-request at lists.python.cn
> Detail Info:
> http://python.cn/mailman/listinfo/python-chinese
>


-- 
Any complex technology which doesn't come with documentation must be the best
available.

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月25日 星期四 10:29

RO rosettas在gmail.com
星期四 十月 25 10:29:26 HKT 2007

谢谢大家,原先不知道原来difflib还有merge的功能,去研究一下

-- 
with kind regards

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月25日 星期四 10:36

vicalloy zbirder在gmail.com
星期四 十月 25 10:36:45 HKT 2007

做wiki?

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月25日 星期四 10:41

RO rosettas在gmail.com
星期四 十月 25 10:41:34 HKT 2007

On 10/25/07, vicalloy <zbirder在gmail.com> wrote:
> 做wiki?

no, 做一个API文档编辑平台,效果像MSDN那样的,呵呵

-- 
with kind regards

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月25日 星期四 13:43

??? ?? clfff.peter在gmail.com
星期四 十月 25 13:43:39 HKT 2007

Ô­À´½Ðdifflibѽ£¬ÊÔÊÔÏÈ  \ : ?


2007/10/25, RO <rosettas在gmail.com>:
>
> On 10/25/07, vicalloy <zbirder在gmail.com> wrote:
> > ×öwiki£¿
>
> no, ×öÒ»¸öAPIÎĵµ±à¼­Æ½Ì¨,Ч¹ûÏñMSDNÄÇÑùµÄ,ºÇºÇ
>
> --
> with kind regards
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071025/211a0e60/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月25日 星期四 19:20

FireBird ygonic在gmail.com
星期四 十月 25 19:20:33 HKT 2007

unixÏÂÓÐÒ»¸ödiffÃüÁÕâ¸öÃüÁîºÃÏñºÜÖøÃûµÄ¡£ÓëÖ®Åä¶ÔµÄ¾ÍÊÇpatch¡£ÒÔÇ°ÔÚLinux
¹¤×÷µÄʱºòÒ»Ö±ÔÙÓÃdiffÃüÁȷʵºÜºÃÓá£
difflibûÓÐÓùý£¬²»¹ý°ïÖúÀïÓбȽÏÏêϸµÄÀý×Ó£¬ÕâÀïÒýÈëÒ»¸öÀý×Ó£º

        >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
        ...              'ore\ntree\nemu\n'.splitlines(1))
        >>> print ''.join(diff),
        - one
        ?  ^
        + ore
        ?  ^
        - two
        - three
        ?  -
        + tree
        + emu


ÔÚ07-10-25£¬??? ?? <clfff.peter在gmail.com> дµÀ£º
>
> Ô­À´½Ðdifflibѽ£¬ÊÔÊÔÏÈ  \ : ?
>
>
> 2007/10/25, RO <rosettas在gmail.com>:
> >
> > On 10/25/07, vicalloy <zbirder在gmail.com> wrote:
> > > ×öwiki£¿
> >
> > no, ×öÒ»¸öAPIÎĵµ±à¼­Æ½Ì¨,Ч¹ûÏñMSDNÄÇÑùµÄ,ºÇºÇ
> >
> > --
> > with kind regards
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
-------------- 下一部分 --------------
Ò»¸öHTML¸½¼þ±»ÒƳý...
URL: http://python.cn/pipermail/python-chinese/attachments/20071025/f16db543/attachment.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月25日 星期四 20:01

Wayne moonbingbing在gmail.com
星期四 十月 25 20:01:01 HKT 2007

如果要实现文件二进制比较的话可以用bsdiff。相当好用
http://www.daemonology.net/bsdiff/

在07-10-25,FireBird <ygonic at gmail.com> 写道:
>
> unix下有一个diff命令,这个命令好像很著名的。与之配对的就是patch。以前在Linux
> 工作的时候一直再用diff命令,确实很好用。
> difflib没有用过,不过帮助里有比较详细的例子,这里引入一个例子:
>
>         >>> diff = ndiff('one\ntwo\nthree\n'.splitlines(1),
>         ...              'ore\ntree\nemu\n'.splitlines(1))
>         >>> print ''.join(diff),
>         - one
>         ?  ^
>         + ore
>         ?  ^
>         - two
>         - three
>         ?  -
>         + tree
>         + emu
>
>
> 在07-10-25,??? ?? <clfff.peter at gmail.com> 写道:
> >
> > 原来叫difflib呀,试试先  \ : ?
> >
> >
> > 2007/10/25, RO <rosettas at gmail.com>:
> > >
> > > On 10/25/07, vicalloy < zbirder at gmail.com> wrote:
> > > > 做wiki?
> > >
> > > no, 做一个API文档编辑平台,效果像MSDN那样的,呵呵
> > >
> > > --
> > > with kind regards
> > > _______________________________________________
> > > python-chinese
> > > Post: send python-chinese at lists.python.cn
> > > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > > Unsubscribe: send unsubscribe to
> > > python-chinese-request at lists.python.cn
> > > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
> >
> >
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to
> > python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> >
>
>
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
>



-- 
wayne
http://blog.csdn.net/wayne92
Kingsoft(Zhuhai)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20071025/29f47bf4/attachment.htm 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月26日 星期五 11:57

RO rosettas在gmail.com
星期五 十月 26 11:57:13 HKT 2007

On 10/25/07, xxmplus <xxmplus在gmail.com> wrote:
> sorry I cant type chinese here.
>
> diff (stands for difference) is a file comparison program that gives
> you differences between two files. the output of "diff" can be applied
> with another program "patch" which does exactly what RO asks for.
>
> diff and patch can be found in most unix/linux system.
>

因为我的系统需要运行在非unix平台上,因此我希望找一个python中可以调用的库来使用

-- 
with kind regards

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

2007年10月26日 星期五 16:04

Wayne moonbingbing在gmail.com
星期五 十月 26 16:04:23 HKT 2007

方法有三个:
1、python 的标准库difflib。
2、DiffUtils for windows,就是linux下面的diff,patch命令的windows版本。
3、bsdiff。这个是bsd里面的。有Windows版本,也有python写的库。
只有bsdiff可以比较二进制文件,有兴趣可以去看看c的源代码(风格不好,不容易看懂,虽然有文档)。

2007/10/26, RO <rosettas at gmail.com>:
>
> On 10/25/07, xxmplus <xxmplus at gmail.com> wrote:
> > sorry I cant type chinese here.
> >
> > diff (stands for difference) is a file comparison program that gives
> > you differences between two files. the output of "diff" can be applied
> > with another program "patch" which does exactly what RO asks for.
> >
> > diff and patch can be found in most unix/linux system.
> >
>
> 因为我的系统需要运行在非unix平台上,因此我希望找一个python中可以调用的库来使用
>
> --
> with kind regards
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to  python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese




-- 
wayne
http://blog.csdn.net/wayne92
Kingsoft(Zhuhai)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20071026/5c9cfce3/attachment-0001.html 

[导入自Mailman归档:http://www.zeuux.org/pipermail/zeuux-python]

如下红色区域有误,请重新填写。

    你的回复:

    请 登录 后回复。还没有在Zeuux哲思注册吗?现在 注册 !

    Zeuux © 2025

    京ICP备05028076号