3 Replies - 641 Views - Last Post: 12 January 2016 - 05:20 AM Rate Topic: -----

#1 pyjack   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-January 16

difference between two files

Posted 12 January 2016 - 04:59 AM

hi everyone, i want to know the difference between two php files that are very similar. their difference is maybe a url, a variable ,etc.. for example i want my output to be '[email protected]'-> '[email protected]' meaning from file1 to file2 [email protected] changed to [email protected] . how do i go about this? any help or suggestion is appreciated.
thanks
Is This A Good Question/Topic? 0
  • +

Replies To: difference between two files

#2 andrewsw   User is offline

  • never lube your breaks
  • member icon

Reputation: 6829
  • View blog
  • Posts: 28,311
  • Joined: 12-December 12

Re: difference between two files

Posted 12 January 2016 - 05:03 AM

Searching "python difference between two files" quickly finds the difflib module.

For example,

Quote

class difflib.Differ

This is a class for comparing sequences of lines of text, and producing human-readable differences or deltas.

Was This Post Helpful? 1
  • +
  • -

#3 ndc85430   User is offline

  • I think you'll find it's "Dr"
  • member icon

Reputation: 984
  • View blog
  • Posts: 3,879
  • Joined: 13-June 14

Re: difference between two files

Posted 12 January 2016 - 05:11 AM

Of course, you don't need to write a Python program to do this - you could use diff on the command line (if you're running some kind of UNIX), or use a graphical diff tool like Meld.
Was This Post Helpful? 0
  • +
  • -

#4 pyjack   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 12-January 16

Re: difference between two files

Posted 12 January 2016 - 05:20 AM

thanks for your suggestions,
I think I will look more into difflib. :balloon:
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1