text_formatter.justify - Justify the strings, according to a certain length

Source code: text_formatter/justify.py

This module provides functions to modify the length of some text Python types, like str or bytes.

text_formatter.justify.justify(s, l)
Parameters
  • s (str) – The string to be justified.

  • l (int) – The expected length per line.

Returns

The string adjusted to the given length per line.

Return type

str

Raises

text_formatter.exceptions.InvalidString – if the applied text_formatter.check.checkString() test fails 1.

A simple function to justify strings. It uses text_formatter.check.checkString() 1 for testing s.

Warning

Even when this documentation is telling that justify() returns the adjusted string, at this moment it only returns an unmodified s. This function needs a larger development, so the actual documentation is not stable at all. See http://github.com/DiddiLeija/text_formatter/issues/1 for more information.

Footnotes

1(1,2)

See the reference for text_formatter.check here.