https://github.com/abilian/buildstr
https://github.com/abilian/buildstr
Last synced: 3 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/abilian/buildstr
- Owner: abilian
- License: other
- Created: 2023-03-15T18:17:59.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-08T13:23:13.000Z (over 1 year ago)
- Last Synced: 2024-07-15T14:00:05.717Z (7 months ago)
- Language: Python
- Size: 57.6 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
- Authors: AUTHORS.rst
Awesome Lists containing this project
- jimsghstars - abilian/buildstr - (Python)
README
# Fancy Pythonic String Builder
[](https://pypi.python.org/pypi/buildstr)
[](https://travis-ci.com/sfermigier/buildstr)
[](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 }"
```