Before I asked, I did some googling, and was unable to find an answer.
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:
File:
1
2
3
7-10
15
20-25
Command Line Arg:
1, 2, 3, 7-10, 15, 20-25
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:
['1','2','3','7','8','9','10','15','20','21','22','23','24','25']
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.
So, my question is this: Given a list[]:
['1','2','3','7-10','15','20-25'],
how can I get a list[]:
['1','2','3','7','8','9','10','15','20','21','22','23','24','25']