title: Indexing lines in a Python file
body: <p>I want to open a file, and simply return the contents of said file with each line beginning with the line number.</p>
  
  <p>So hypothetically if the contents of <code>a</code> is</p>
  
  <pre><code>a
  
  b
  
  c
  </code></pre>
  
  <p>I would like the result to be </p>
  
  <pre><code>1: a
  
  2: b
  
  3: c
  </code></pre>
  
  <p>Im kind of stuck, tried enumerating but it doesn't give me the desired format.</p>
  
  <p>Is for Uni, but only a practice test. </p>
  
  <p>A couple bits of trial code to prove I have no idea what I'm doing / where to start</p>
  
  <pre><code>def print_numbered_lines(filename):
      """returns the infile data with a line number infront of the contents"""
      in_file = open(filename, 'r').readlines()
      list_1 = []
      for line in in_file:
          for item in line:
              item.index(item)
              list_1.append(item)
      return list_1
  
  def print_numbered_lines(filename):
      """returns the infile data with a line number infront of the contents"""
      in_file = open(filename, 'r').readlines()
      result = []
      for i in in_file:
          result.append(enumerate(i))
      return result
  </code></pre>