cape.tnakit.textutils.wrap: Text-wrapping toolkit¶
This module contains common functions for wrapping long strings into a limited-length lines
- cape.tnakit.textutils.wrap.wrap_text(txt, cwidth=79, indent=4, cwidth1=None, indent1=None)¶
Convert a long string into multiple lines of text
- Call:
>>> lines = wrap_text(txt, cwidth=79, indent=4, **kw)
- Inputs:
- txt:
str|unicode A string, which may be very long
- cwidth: {
79} |int Maximum line length
- indent: {
4} |int Number of leading white spaces in each line
- cwidth1: {cwidth} |
int Maximum length for the first line
- indent1: {indent} |
int Number of leading white spaces in first line
- txt:
- Outputs:
- lines:
list(str) List of lines, each less than cwidth chars unless there is a word that is longer than cwidth chars
- lines:
- Versions:
2018-03-07
@ddalle: Version 1.0