title: Counting lines, words, and characters within a text file using Python
body: <p>I'm having a bit of a rough time laying out how I would count certain elements within a text file using Python. I'm a few months into Python and I'm familiar with the following functions; </p>
  
  <ul>
  <li>raw_input</li>
  <li>open</li>
  <li>split</li>
  <li>len</li>
  <li>print</li>
  <li>rsplit()</li>
  </ul>
  
  <p>Here's my code so far:</p>
  
  <pre><code>fname = "feed.txt"
  fname = open('feed.txt', 'r')
  
  num_lines = 0
  num_words = 0
  num_chars = 0
  
  for line in feed:
      lines = line.split('\n')
  </code></pre>
  
  <p>At this point I'm not sure what to do next. I feel the most logical way to approach it would be to first count the lines, count the words within each line, and then count the number of characters within each word. But one of the issues I ran into was trying to perform all of the necessary functions at once, without having to re-open the file to perform each function seperately.  </p>