<div class="gmail_quote">On Thu, Jun 4, 2009 at 3:07 PM, Ruchir Shukla <span dir="ltr">&lt;<a href="mailto:ruchiryshukla@gmail.com">ruchiryshukla@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
import difflib<br>f=open(&#39;text1.txt&#39;,&#39;rb&#39;)<br>text1=f.read()<br>f.close()<br>f=open(&#39;text2.txt&#39;,&#39;rb&#39;)<br>text2=f.read()<br>f.close()<br>#print text1<br>#print text2<br>text1_lines = text1.splitlines(1)<br>


text2_lines = text2.splitlines(1)<br>d = difflib.HtmlDiff()<br><br>diff = d.make_file(text1_lines, text2_lines)<br>print diff<br><br><br>To find difference this program and  <b>&quot;difflib&quot;</b> library can help you <br>


HtmlDiff will return the HTML format of the comparison. <br><br>if u are looking for output in plain text format then following can help you.<br><br>import difflib<br>d = difflib.Differ()<br>diff = d.compare(text1_lines, text2_lines)<br>


</blockquote></div><br><br>Do NOT spoonfeed! *sigh*<br><br>-V-<br>