An open API service indexing awesome lists of open source software.

https://github.com/abilian/buildstr


https://github.com/abilian/buildstr

Last synced: 3 months ago
JSON representation

Awesome Lists containing this project

README

        

# Fancy Pythonic String Builder

[![image](https://img.shields.io/pypi/v/buildstr.svg)](https://pypi.python.org/pypi/buildstr)

[![image](https://img.shields.io/travis/sfermigier/buildstr.svg)](https://travis-ci.com/sfermigier/buildstr)

[![Documentation Status](https://readthedocs.org/projects/str-builder/badge/?version=latest)](https://str-builder.readthedocs.io/en/latest/?version=latest)

- Free software: Apache Software License 2.0

## Features

- Builds strings in a pythonic way.
- We're using the `with` statement to build substrings.
- Python code can be interleaved with the string building.

Useful for generating code.

## Example

```python

from buildstr import Builder

b = Builder("A")
b << "B"
with b(surround=("{ ", " }"), separator="; ") as b1:
b1 << ["a", "b", "c"]

assert b.build() == "A B { a; b; c }"
```