reindent

emlib.textlib.reindent(text, prefix='', stripEmptyLines=True)[source]

Reindent a given text. Replaces the indentation with a new prefix.

Parameters:
  • text (str) – the text to reindent

  • prefix – the new prefix to add to each line

  • stripEmptyLines – if True, remove any empty lines at the beginning or end of text

Return type:

str

Returns:

the reindented text