title: What does .readline() return in Python?
body: <p>EDIT of entire post, in order to be more clear of the problem:</p>
  
  <pre><code>s = "GATATATGCATATACTT"
  t = "ATAT"
  
  for i in range(len(s)):
      if t == s[i:i+len(t)]:
          print i+1,
  </code></pre>
  
  <p>So the purpose of the program above is to scan through the long line of DNA (s) with the short line of DNA (t), in order to find at which positions on s, that t matches. The output of the above code is:</p>
  
  <p>2 4 10    #This are basically the index numbers of string s that string t matches. but as can be seen in the code above, it's i+1 to give a 1-based numbering output.</p>
  
  <p>The problem I'm having is that when i try to change the code, in order to make it receive the values for s and t through a file, the readline() function is not working for me. The motif.txt file contains two strings of DNA, one on each line. </p>
  
  <pre><code>with open('txt/motif.txt', 'r') as f:
  
      s = f.readline()
      t = f.readline()
  
      for i in range(len(s)):
          if t == s[i:i+len(t)]:
              print i+1,
  </code></pre>
  
  <p>So this code, on the other hand will output nothing at all. But when I change t to:</p>
  
  <pre><code>t = f.readline().strip()
  </code></pre>
  
  <p>Then the program outputs the same result as the first example did.</p>
  
  <p>So i hope this has made things more clear. My question is thus, if readline() returns a string, why isn't my program in example 2 working in the same way as in the very first example?</p>