title: Python Finding Range of Hyphenated Numbers in File
body: <p>I have a text file formatted like so</p>
  
  <pre><code>1-8
  10-12
  14-45
  48-50
  </code></pre>
  
  <p>How do I go about getting the range of each line?</p>
  
  <pre><code>1, 2, 3, 4, 5, 6, 7, 8
  10, 11, 12
  </code></pre>
  
  <p>I've tried splitting the file to get each number into a list. 1, 8, 10, 12, 14, 45, 48, 50, but I'm not sure how to translate that into the start and end numbers for range.</p>
  
  <pre><code>data = []
  with open('file.txt','r') as myfile:
      for line in myfile:
          data.extend(map(int, line.split('-')))
  print (data)
  </code></pre>