title: Values in a list to a range()
body: <p>I have a user input which comes in as follows:</p>
  <pre><code>j = ['1', '2', '3', '4', '5-6', '7-9']
  </code></pre>
  <p>I want to go through this list, identify any 'ranges' such as <code>7-8</code>, or <code>5-99</code> etc.</p>
  <p>With these remove the <code>-</code> and put the first and second values into <code>range()</code></p>
  <p>So far I have the following, I just can't figure out how to get the values into the right place, perhaps I need to select the number before the <code>-</code> and after the <code>-</code> ?</p>
  <pre><code>        for item in j:
              if &quot;-&quot; in item:
                  item = item.split(&quot;-&quot;)
                  # list(map(str, range(244, 247)))
                  for r in item:
                      print(r)
                      print('next')
  
                  # something like this?
                  list(map(str, range(int(item[0]), int(item[1]))))
  </code></pre>
  <p>EDIT</p>
  <p>Taking into account jonrsharpe's comment:</p>
  <pre><code>        for item in j:
              if &quot;-&quot; in item:
                  start, stop = item.split(&quot;-&quot;)
                  print('start:' + start + ' end: ' + stop)
                  list(map(str, range(int(start), int(stop))))
                  
  </code></pre>
  <p>This returns a type error <code>TypeError: 'str' object is not callable</code></p>