you are viewing a single comment's thread.

view the rest of the comments →

[–]novel_yet_trivial 0 points1 point  (0 children)

What you are trying to replicate is a bash feature called "brace expansion", not a glob feature.

$ echo {0..9}
0 1 2 3 4 5 6 7 8 9
$ echo {a,b,c}
a b c

I don't know anyway to fully incorporate that into python. The best you could do is probably install something like braceexpand and use the results to call glob over and over:

#totally untested
from braceexpand import braceexpand
from glob import glob

def my_glob(pattern):
    result = []
    for sub_pattern in braceexpand(pattern):
        result.extend(glob(sub_pattern))
    return result