https://github.com/pykit3/k3fmt
It provides with several string operation functions.
https://github.com/pykit3/k3fmt
fmt python string
Last synced: 4 months ago
JSON representation
It provides with several string operation functions.
- Host: GitHub
- URL: https://github.com/pykit3/k3fmt
- Owner: pykit3
- License: mit
- Created: 2021-08-04T08:41:09.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2025-08-28T12:36:35.000Z (9 months ago)
- Last Synced: 2025-11-02T19:08:27.855Z (7 months ago)
- Topics: fmt, python, string
- Language: Python
- Homepage: https://blog.openacid.com
- Size: 39.1 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# k3fmt
[](https://github.com/pykit3/k3fmt/actions/workflows/python-package.yml)
[](https://k3fmt.readthedocs.io/en/stable/?badge=stable)
[](https://pypi.org/project/k3fmt)
It provides with several string operation functions.
k3fmt is a component of [pykit3] project: a python3 toolkit set.
# Name
k3fmt
It provides with several string operation functions.
# Status
This library is considered production ready.
# Install
```
pip install k3fmt
```
# Synopsis
```python
import k3fmt
lines = [
'hello',
'world',
]
# add left padding to each line in a string
k3fmt.line_pad('\n'.join(lines), ' ' * 4)
# " hello"
# " world"
# format a multi-row line
items = ['name:',
['John',
'j is my nick'
],
'age:',
26,
'experience:',
['2000 THU',
'2006 sina',
'2010 other'
],
]
k3fmt.format_line(items, sep=' | ', aligns='llllll')
# outputs:
# name: | John | age: | 26 | experience: | 2000 THU
# | j is my nick | | | | 2006 sina
# | | | | | 2010 other
```
# Author
Zhang Yanpo (张炎泼)
# Copyright and License
The MIT License (MIT)
Copyright (c) 2015 Zhang Yanpo (张炎泼)
[pykit3]: https://github.com/pykit3