doctestprinter.strip_trailing_whitespaces_and_tabs

doctestprinter.strip_trailing_whitespaces_and_tabs(text: str)str

Strips both trailing whitespaces and tabs from the text. Introduced in 1.1.0.

Parameters

text (str) – Text from which trailing tabs should be removed.

Returns

str

Examples

>>> sample_text = "A sample text with    \n trailing whitespaces.   \n\t"
>>> strip_trailing_whitespaces_and_tabs(sample_text)
'A sample text with\n trailing whitespaces.'
>>> sample_text = "A sample text with    \n trailing whitespaces.   \nEnd.\t"
>>> strip_trailing_whitespaces_and_tabs(sample_text)
'A sample text with\n trailing whitespaces.\nEnd.'
>>> 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_and_tabs(sample_text)
'A sample text with\n trailing whitespaces.\nEnd.'