How can i easily handle numberseries formated with brackets?
<p>I have a long list of numberseries formated like this:</p>

<pre><code>["4450[0-9]", "6148[0-9][0-9]"]
</code></pre>

<p>I want to make a list from one of those series with single numbers:</p>

<pre><code>[44500,44501,..., 44509]
</code></pre>

<p>i need to do this for many series within the original list and i'm wondering what the best way is for doing that?</p>

<pre><code>def invertRE(x):
    if not x:
        yield []
    else:
       idx = 1 if not x.startswith("[") else x.index("]") + 1
       for rest in invertRE(x[idx:]):
           if x.startswith("["):
               v1,v2 = map(int,x[1:idx-1].split("-"))
               for i in range(v1,v2+1):
                  yield [str(i),]+rest
           else:
               yield [x[0],] + rest

print(map("".join,invertRE("123[4-7][7-8]")))
</code></pre>

<p>Im pretty sure this will work ... but really you should try something on your own before comming here ...</p>

python numbers series number-sequence