title: Insert string at the beginning of each line
body: <p>How can i insert a string at the beginning of each line in a text file, i have the following code:</p>
  
  <pre><code>f = open('./ampo.txt', 'r+')
  with open('./ampo.txt') as infile:
      for line in infile:
          f.insert(0, 'EDF ')
  f.close
  </code></pre>
  
  <p>i get the following error:</p>
  
  <p>"'file' object has no attribute 'insert'"</p>
  
  <p>Please note that im a complete programming n00b.</p>