title: Expanding a block of numbers in Python
body: <p>Before I asked, I did some googling, and was unable to find an answer.</p>
  
  <p>The scenario I have is this:
  A list of numbers are passed to the script, either \n-delimited via a file, or comma-delimited via a command line arg. The numbers can be singular, or in blocks, like so:</p>
  
  <p>File:</p>
  
  <pre><code>1
  2
  3
  7-10
  15
  20-25
  </code></pre>
  
  <p>Command Line Arg:</p>
  
  <pre><code>1, 2, 3, 7-10, 15, 20-25
  </code></pre>
  
  <p>Both end up in the same list[]. I would like to expand the 7-10 or 20-25 blocks (obviously in the actual script these numbers will vary) and append them onto a new list with the final list looking like this:</p>
  
  <pre><code>['1','2','3','7','8','9','10','15','20','21','22','23','24','25']
  </code></pre>
  
  <p>I understand that something like .append(range(7,10)) could help me here, but I can't seem to be able to find out which elements of the original list[] have the need for expansion.</p>
  
  <p>So, my question is this:
  Given a list[]:</p>
  
  <pre><code>['1','2','3','7-10','15','20-25'],
  </code></pre>
  
  <p>how can I get a list[]:</p>
  
  <pre><code> ['1','2','3','7','8','9','10','15','20','21','22','23','24','25']
  </code></pre>