Skip to main content

fill_paragraphs

Fill paragraphs with newlines (or custom separator).

def fill_paragraphs(
s: str,
width: int,
sep: str = \n
) - > str

Fill paragraphs with newlines (or custom separator).

Parameters

NameTypeDescription
sstrThe input text containing one or more paragraphs to be wrapped.
widthintThe maximum number of characters allowed per line within each paragraph.
sepstr = \nThe character sequence used to identify paragraph boundaries and to join the processed paragraphs.

Returns

TypeDescription
strThe input text with each individual paragraph wrapped to the specified width, joined by the separator.