All you need comes from difflib - for example:
>>> import difflib
>>> d = difflib.Differ()
>>> l = list(d.compare("hello", "heXXo"))
>>> l
[' h', ' e', '- l', '- l', '+ X', '+ X', ' o']
Each item in this list is a character from your two input lines, prefixed with one of
" " (2 spaces), the character present in this position on both lines"- " (space), the character present in this position in the first line"+ " ( ), .
, , .
, difflib docs.