title: How can I fix ValueError: Too many values to unpack" in Python?
body: <p>I am trying to populate a dictionary with the contents of my text file ("out3.txt").</p>
  
  <p>My text file is of the form:</p>
  
  <pre><code>vs,14100
  
  mln,11491
  
  the,7973
  
  cts,7757
  </code></pre>
  
  <p>...and so on...</p>
  
  <p>I want my dictionary <code>answer</code> to be of the form:</p>
  
  <pre><code>answer[vs]=14100
  
  answer[mln]=11491
  </code></pre>
  
  <p>...and so on...</p>
  
  <p>My code is:</p>
  
  <pre><code>import os
  import collections
  import re
  from collections import defaultdict
  
  answer = {}
  answer=collections.defaultdict(list)
  with open('out3.txt', 'r+') as istream:
      for line in istream.readlines():
          k,v = line.strip().split(',')
          answer[k.strip()].append( v.strip())
  </code></pre>
  
  <p>But, I get:</p>
  
  <blockquote>
    <p>ValueError: too many values to unpack</p>
  </blockquote>
  
  <p>How can I fix this?</p>