Compare one of the 2 files in Python without the content
#!/usr/bin/env python
#coding: UTF8
def file (file_name):
Filea_list,fileb_list = [],[]
Filea_name,fileb_name = File_name.split ()
With open (Filea_name) as FA:
For line in Fa.readlines ():
Filea_list.append (Line.split ())
With open (Fileb_name) as FB:
For line in Fb.readlines ():
Fileb_list.append (Line.split ())
Return filea_list,fileb_list
def func ():
filea_list,fileb_list = File (file_name)
If Len (filea_list) > Len (fileb_list):
For line in Fileb_list:
Filea_list.remove (line)
Print Filea_list
Else
For line in Filea_list:
Fileb_list.remove (line)
Print Fileb_list
If __name__== ' __main__ ':
print "Input" files "
file_name = Raw_input ("Enter The other files you need to compare:")
Func ()
Attached source code:
Also have EXE format can be executed under Windows but only in English Chinese is not able to execute
Python achieves 2 file comparisons