Reputation: 6844
path = 'foo/{bar1,bar2}'
How to expand to ['foo/bar1', 'foo/bar2'] as the bash shell would? I've tried glob, os.path.realpath and I don't see anything in shutil either.
Upvotes: 1
Views: 867
Reputation: 5776
You could get bash to do it for you ;)
paths = subprocess.check_output('bash -c "echo foo/{bar1,bar2}"', shell=True).split()
Upvotes: 2
Reputation: 222812
There's no builtin way to do that. You'd need to write some parsing code to extract the elements.
Upvotes: 0