I am looking for some python script to compare two files

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • david

    #1

    I am looking for some python script to compare two files

    hi:

    The file can be PDF or Word format. Any help?

    thx

  • Miki Tebeka

    #2
    Re: I am looking for some python script to compare two files

    Hello david,
    [color=blue]
    > The file can be PDF or Word format. Any help?[/color]
    If just like to know if they differ you can compare their md5 signature (or
    any other digital signature).

    If you want a real diff then convert them to text.
    * For PDF you can use pdftotext (comes with xpdf) or Acrobat COM object (if
    you're on windows). There are also some commercial pdf2txt programs.
    * For word you can use antiword and friends and again the word COM object
    if you're on windows.

    See the diffutils package for diffing text files.

    HTH.
    --
    ------------------------------------------------------------------------
    Miki Tebeka <mtebeka@qualco mm.com>

    The only difference between children and adults is the price of the toys

    -----BEGIN PGP SIGNATURE-----
    Version: GnuPG v1.4.1 (Cygwin)

    iD8DBQFDcaVV8jA dENsUuJsRAvP/AJ43qqe4Z1roQOk lxodhtqZtjmcAcQ CeNLN9
    bMAQZ23sJCewCYW 53CcVjdw=
    =ycXe
    -----END PGP SIGNATURE-----

    Comment

    • Dennis Lee Bieber

      #3
      Re: I am looking for some python script to compare two files

      On 8 Nov 2005 19:35:07 -0800, "david" <yongsheng.yang @gmail.com>
      declaimed the following in comp.lang.pytho n:
      [color=blue]
      > hi:
      >
      > The file can be PDF or Word format. Any help?
      >[/color]
      Install an ASCII-only print driver
      Print "to file" using this driver
      Compare text files.

      PDF is a variation of PostScript -- that is, the contents are a
      specially optimized programming language for rendering text. The text
      could be identical but all the code surrounding it could be different.
      (I've seen PostScript drivers for word processors vary between passing a
      single line of text to a function that then character spaced the text
      for justification, vs another that computed starting locations for each
      word, passing words to the rendering function).

      Word documents, too, could "look" identical when printed, but be
      completely different internally. Word files may have things like linked
      sections as one has edited, and remnants of such things as unused style
      tags.

      --[color=blue]
      > =============== =============== =============== =============== == <
      > wlfraed@ix.netc om.com | Wulfraed Dennis Lee Bieber KD6MOG <
      > wulfraed@dm.net | Bestiaria Support Staff <
      > =============== =============== =============== =============== == <
      > Home Page: <http://www.dm.net/~wulfraed/> <
      > Overflow Page: <http://wlfraed.home.ne tcom.com/> <[/color]

      Comment

      Working...