def print_diffs(text1, text2):
 lines1 = text1.splitlines(True)
 lines2 = text2.splitlines(True)
 diffs = difflib.unified_diff(lines1, lines2, n=0, fromfile='expected', tofile='got')
 print ('\n' + ''.join(diffs))

def print_diffs ( text1 , text2 ) : lines1 = text1 . splitlines ( True ) lines2 = text2 . splitlines ( True ) diffs = difflib . unified_diff ( lines1 , lines2 , n = 0 , fromfile = 'expected' , tofile = 'got' ) print ( '\n' + '' . join ( diffs ) )
prints unified diffs for two texts .