title: How do I remove \n from my python dictionary?
body: <p>So I have a text file that is something like:</p>
  
  <pre><code>apples,green
  tomatos,red
  bananas,yellow
  </code></pre>
  
  <p>and my code to use this as a dictionary is</p>
  
  <pre><code>def load_list(filename):
      with open(filename, "rU") as my_file:
          my_list = {}
          for line in my_file:
              x = line.split(",")
              key = x[0]
              value = x[1]
              my_list[key] = value
          print my_list
  </code></pre>
  
  <p>which works fine, except that every value has \n added to the end of it, because of the line break. I tried adding</p>
  
  <pre><code>.strip()
  </code></pre>
  
  <p>to the x attribute, but it reulsted in an attribute error (AttributeError: 'dict' object has no attribute 'strip').</p>
  
  <p>So how do I remove the \n?</p>