Bash-style brace expansion for Python
Project description
Implements Brace Expansion as described in bash(1), with the following limitations:
A pattern containing unbalanced braces will raise an UnbalancedBracesError exception. In bash, unbalanced braces will either be partly expanded or ignored.
A mixed-case character range like '{Z..a}' or '{a..Z}' will not include the characters []^_` between Z and a.
The braceexpand function returns an iterator over the expansions generated from a pattern.
Example:
>>> from braceexpand import braceexpand
>>> list(braceexpand('python{2.{5..7},3.{2,3}}'))
['python2.5', 'python2.6', 'python2.7', 'python3.2', 'python3.3']
Installation
Drop the braceexpand.py file into your project, or install the braceexpand package from pypi:
$ pip install braceexpand
License
braceexpand is licensed unter the MIT License. See the included file LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.