- import difflib
- import os
- text1 = input("Enter text: \n")
- os.system('clear')
- text2 = input("Enter a second text: \n")
- os.system('clear')
- print("Differences Below:")
- print("------------------")
- text1 = text1.splitlines()
- text2 = text2.splitlines()
- d = difflib.Differ()
- diff = d.compare(text1, text2)
- print("\n".join(diff))