Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/msabramo/pyindent
Super simple indent function for python that indents existing text
https://github.com/msabramo/pyindent
Last synced: about 1 month ago
JSON representation
Super simple indent function for python that indents existing text
- Host: GitHub
- URL: https://github.com/msabramo/pyindent
- Owner: msabramo
- License: mit
- Created: 2015-02-17T00:37:31.000Z (almost 10 years ago)
- Default Branch: master
- Last Pushed: 2015-02-17T00:38:26.000Z (almost 10 years ago)
- Last Synced: 2024-05-09T20:40:43.332Z (8 months ago)
- Language: Python
- Size: 110 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pyindent
Super simple indent function for python that indents existing textpip install pyindent
It doesn't get much simpler:
from pyindent import pyindent
from pprint import pformat
product = {
"id": 1,
"name": "A blue door This could be a really long line as well and it could optionally be truncated (handy for output on screen)",
"price": 12.50,
"tags": ["home", "blue"]
}
# produces nicely indented output, with long lines truncated as needed.
# handy for reading voluminous output from a data store
print pyindent(pformat(product), indent=4, truncate=60)
{'id': 1,
'name': 'A blue door This could be a really long line as we
'price': 12.5,
'tags': ['home', 'blue']}Read all two lines of the source code to see what it does.
If you need something bigger, check out
https://github.com/scottt/scottt-bin/blob/master/pyindent