title: speeding up a python code with 2 for loops
body: <p>I have the following python code snippet that I would like to speed up:</p>
  
  <pre><code>in_file1 = open('file1.txt', 'r')
  
  for line1 in in_file:
      col1,col2,col3,col4=line1.rstrip.split("\t")
      with open('flie2.txt', 'r') as in_file2:
          for line2 in in_file2:
              col1,col2,col3,col4=line2.rstrip.split("\t")
              if col1 in line1 == col1 in line2:
                  print the line from file2
  </code></pre>
  
  <p>File sizes are in GB. Can anyone suggest a way (or ways) to replace the for loops to speed up the code?</p>
  
  <p>Thanks</p>