compare file contents using python
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/6235126/comparing-contents-of-two-files-using-python">comparing contents of two files using python</a>  </p>
</blockquote>



<p>I have a file name globalexclusionlist.txt and i have contents in it like</p>

<pre><code>      #include &lt;stdio.h&gt;
      #include &lt;iostream&gt;
      import subprocess
      import java.sql.*;import java.io.*;
      ruby library
      show tables; 

      ......and many more
</code></pre>

<p>I have another file named libraries.txt and the contents of this file are</p>

<pre><code>     import mymodule
     import empmodule,os
     import subprocess
     import java.sql.*
     #include &lt;stdio.h&gt;
     #include &lt;iostream&gt;
     import datetime,logging,re
     import java.io.*;
     .......and many more
</code></pre>

<p>My question is that from python how to know that the contents which are in exclusionlist.txt is also present in libraries.txt since here it is jumbled up..</p>

<pre><code>     f = open('globalexclusionlist.txt', 'r')
     f.read()

     f1= open('libraries.txt', 'r')
     f1.read()

    if (//Is contents of f1 present in f2):
         print libraries found
    else:
         print not found

    f.close()
    f1.close() 
</code></pre>
