mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-27 22:11:07 +00:00
14 lines
454 B
Python
14 lines
454 B
Python
|
from difflib import SequenceMatcher
|
||
|
|
||
|
def similarity_per(f1,f2):
|
||
|
with open(f1,errors="ignore") as file1,open(f2,errors="ignore") as file2:
|
||
|
file1_data=file1.read()
|
||
|
file2_data=file2.read()
|
||
|
similarity=SequenceMatcher(None,file1_data,file2_data).ratio()
|
||
|
print(f"these 2 files are {similarity*100} % similar")
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
f1=input("file 1 path :")
|
||
|
f2=input("file 2 path :")
|
||
|
similarity_per(f1,f2)
|