title: Comparing lines of two text files in python
body: <p>I have two log files which contains following lines.I want to compare if data present is same or different in both of these files. </p>
  
  <p>In this <code>file1.txt</code> data from <code>736.199070736:</code> to <code>0x000a00f5)</code> make it in a single line. 
  It will come like this </p>
  
  <pre><code>736.199070736:  LOG_MOD_L0_RECEIVE_TXBRP_CONTROL(0, 0x0075007f, 0x005500dd, 0x007f00d7, 0x0057005f, 0x00ff007d, 0x00f700dd, 0x00f50057, 0x000a00f5).
  </code></pre>
  
  <p>And in <code>file2.txt</code> the first line is:</p>
  
  <pre><code>736.199047132:  LOG_TXBP_MOD_IF_RSP_DPCCH(BlockNum: 0, 0x0075007f, 0x005500dd, 0x007f00d7, 0x0057005f, 0x00ff007d, 0x00f700dd, 0x00f50057, 0x000a00f5)
  </code></pre>
  
  <p>So from the first line of both these files:
  I want to compare the data From first line of <code>file1.txt</code>
      (0, 0x0075007f, 0x005500dd, 0x007f00d7, 0x0057005f, 0x00ff007d, 0x00f700dd, 0x00f50057, 0x000a00f5)</p>
  
  <p>and the data From first line of <code>file2.txt</code>
      (BlockNum: 0, 0x0075007f, 0x005500dd, 0x007f00d7, 0x0057005f, 0x00ff007d, 0x00f700dd, 0x00f50057, 0x000a00f5)</p>
  
  <p>I need to remove the <code>BlockNum:</code> text and then compare.</p>
  
  <p>File1.txt which contains:</p>
  
  <pre><code>736.199070736:  LOG_MOD_L0_RECEIVE_TXBRP_CONTROL(0, 
   0x0075007f, 
   0x005500dd, 
   0x007f00d7, 
   0x0057005f, 
   0x00ff007d, 
   0x00f700dd, 
   0x00f50057, 
   0x000a00f5)
   736.209069960: LOG_MOD_L0_RECEIVE_TXBRP_CONTROL(0, 
   0x0075007b, 
   0x005500dd, 
   0x007f00d7, 
   0x0057005f, 
   0x00ff007d, 
   0x00f700dd, 
   0x00f50057, 
   0x000a00f1)
  </code></pre>
  
  <p>'file2.txt' contains:</p>
  
  <pre><code>736.199047132:  LOG_TXBP_MOD_IF_RSP_DPCCH(BlockNum: 0, 0x0075007f, 0x005500dd, 0x007f00d7, 0x0057005f, 0x00ff007d, 0x00f700dd, 0x00f50057, 0x000a00f5)
  736.209044558:  LOG_TXBP_MOD_IF_RSP_DPCCH(BlockNum: 0, 0x0075007f, 0x005500dd, 0x007f00d7, 0x0057005f, 0x00ff007d, 0x00f700dd, 0x00f50057, 0x000a00f5)
  </code></pre>
  
  <p>My code is:</p>
  
  <pre><code>fin1=open("file1.txt","r")
  fin2=open("file2.txt","r")
    for line1 in fin1:
        for line2 in fin2:
           if line==line2:
              print "same data"
           else:
              print "data are different"
  </code></pre>
  
  <p>This is not comparing properly what I want exactly. </p>