doctestprinter.strip_trailing_whitespaces

doctestprinter.strip_trailing_whitespaces(text: str)str

Strips trailing whitespaces from the text. Introduced in 1.1.0.

Parameters

text (str) – Text from which trailing whitespaces should be stripd.

Returns

str

Examples

>>> sample_text = "A sample text with    \n trailing whitespaces.   \n   "
>>> strip_trailing_whitespaces(sample_text)
'A sample text with\n trailing whitespaces.'
>>> sample_text = "A sample text with    \n trailing whitespaces.   \nEnd. "
>>> strip_trailing_whitespaces(sample_text)
'A sample text with\n trailing whitespaces.\nEnd.'