align_text#
- dpeeg.utils.align_text(prefix: str, text: str, only_head: bool = True) str[source]#
Aligns text, adding a specified prefix to the beginning of line.
- Parameters:
prefix (str) – The prefix to be added at the beginning of line.
text (str) – The text to be aligned, including multiple lines.
only_head (bool) – If false, prefix will be prepended to each line. Otherwise, spaces with a length of prefix will be added to other lines except the first line.
- Returns:
align_text – The aligned text.
- Return type:
str
Examples
>>> print(align_text("+ ", text, only_head=False)) + First line + Second line