This library provides functions that allow you to expand a string that contains parenthesis with numeric-values, and then expands that into an actual string value.
$ pip install expand_string
Simple example:
from expand_string import expand_string
expand_string('N3(S)N2(E3(NW))')
Would result in the output:
NSSSNENWNWNWENWNWNW
Shell example:
python -m expand_string 'N3(S)N2(E3(NW))'
Would result in the output:
NSSSNENWNWNWENWNWNW
For more details see the expand_string
docstring.