File size: 313 Bytes
103a375
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
from difflib import Differ

def diff_texts(text1, text2):
    d = Differ()

    d3= []
    for token in d.compare(text1, text2):
        if token[0] != '-':
            if token[0] != " ":
               d3.append((token[2:], token[0]))
            else:
                d3.append((token[2:], None))
    return d3