title: How to strip file contents into a list in python and chart using matplotlib
body: <p>I have a text file which contains the following information with each entry on a single line:</p>
  
  <pre><code>    Rent: 500
      Gas: 60
      Food: 200
      Clothing: 100
      Vehicle Costs: 100
      Entertainment: 200
      Utilities: 200
      Other Misc: 150 
  </code></pre>
  
  <p>My task is to Write a Python program that records the data from the file and uses matplotlib to plot a pie chart showing how you spend your money. I am having trouble with how to strip the value off of the text. Here is my code so far:</p>
  
  <pre><code>import matplotlib
  import os
  def main ():
      infile = open('expenses.txt', 'r')
      cost = infile.readlines()
      infile.close()
      cost = []
      cost_val = line.strip().split() 
      scores.appendint(int(score_val))   
      values = values.split('\n')
      values= [int(i) for i in values]
      print(values)
  </code></pre>
  
  <p>I am getting this error:</p>
  
  <blockquote>
    <p>NameError: name 'line' is not defined</p>
  </blockquote>