title: python split function error in "too many values to unpack"
body: <p>i am trying to figure out why i am getting the below error, i guess i get why i am getting the error but how do i make this work?</p>
  
  <pre><code>&gt;&gt;&gt; port = '22-80'
  &gt;&gt;&gt; fromport, toport = port.split('-')
  &gt;&gt;&gt; fromport
  '22'
  &gt;&gt;&gt; toport
  '80'
  &gt;&gt;&gt; 
  &gt;&gt;&gt; # Here is the error
  &gt;&gt;&gt; 
  &gt;&gt;&gt; port = '-1--1'
  &gt;&gt;&gt; fromport, toport = port.split('-')
  
  Traceback (most recent call last):
    File "&lt;pyshell#192&gt;", line 1, in &lt;module&gt;
      fromport, toport = port.split('-')
  ValueError: too many values to unpack
  &gt;&gt;&gt; 
  &gt;&gt;&gt; 
  </code></pre>
  
  <p>the output should be fromport should be -1 and toport should be -1 as well</p>