title: How to use Python's difflib to produce side-by-side comparison of two files similar to Unix sdiff command?
body: <p>I am using Python 2.6 and I want to create a simple GUI with two side-by-side text panes comparing two text files (file1.txt &amp;  file2.txt) . </p>
  
  <p>I am using <a href="https://docs.python.org/2/library/difflib.html" rel="noreferrer">difflib</a> but it is not clear for me how to produce a result similar to the <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?sdiff+1" rel="noreferrer">sdiff</a> Unix command. </p>
  
  <p>In order to reproduce a side-by-side comparison, I need <a href="https://docs.python.org/2/library/difflib.html" rel="noreferrer">difflib</a> to return two variables <code>file1_diff</code> and <code>file2_diff</code>, for instance.</p>
  
  <p>I have also considered to use <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?sdiff+1" rel="noreferrer">sdiff</a> output directly and parse it to separate the panes but it turned out not to be as easy as it seems... Any hints? </p>