title: Reading specific lines from a file in a loop (optimization)
body: <p>I'm reading specific lines from a text file. Here is my code:</p>
  
  <pre><code>file.seek(0)
  for j, ln in enumerate(file):
     if j == line_number
        line = ln   # i'm getting the line
        break
  </code></pre>
  
  <p>It tooks a <strong>long time</strong> when I use this code in a "loop" where the line_number is random every turn.
  I also tried linecache.getline() but it needs to be call linecache.clearcache() every turn, so its not better.</p>
  
  <p>Is there a faster solution for that? Memory doesn't matter.</p>