Python Forum
Diff between 1 file to serveral files
Poll: Diff file
You do not have permission to vote in this poll.
Diff
0%
0 0%
File
0%
0 0%
Total 0 vote(s) 0%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Diff between 1 file to serveral files
#1
Hello,

I have a small script I found that will compare 2 files my issue is how can I campare 1 file to many files?

Thanks.

#!/usr/bin/python
import difflib

old_path = 'Original.txt'
new_path = 'New.txt'

old_path_file = open(old_path).readlines()
new_path_file = open(new_path).readlines()

difference = difflib.HtmlDiff().make_file(old_path_file, new_path_file, old_path, new_path)
difference_report = open('./diff_report.html','w')
difference_report.write(difference)
difference_report.close()
Reply
#2
Diffuse can compare any number of files at once: http://diffuse.sourceforge.net/index.html
It's written in python, so you can check out how they do it: https://sourceforge.net/p/diffuse/code/H...in/diffuse
Reply
#3
thanks for the info.
Reply
#4
I checked the link but still dont know how to make a compare from many to one.

thanks.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to diff pandas rows and modify column value Mekala 1 1,745 Sep-18-2020, 12:38 PM
Last Post: Mekala
  Details of attachment files in a msg file such as file names save into a python list klllmmm 2 5,770 Nov-12-2019, 05:59 AM
Last Post: klllmmm
  Diff. between Py 2.7 and 3 ebolisa 2 7,975 Dec-15-2018, 11:46 AM
Last Post: ebolisa
  Diff. between Py 2.7 and 3 ebolisa 1 2,149 Nov-01-2018, 06:45 PM
Last Post: wavic
  Diff Check - Print from dcmp.diff_files ipuente 0 2,661 Jun-22-2018, 09:44 PM
Last Post: ipuente

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020