NOTE: Under Construction - I'm in the middle of upgrading my site and lots of stuff is kinda broken. Please forgive the mess.

Remove Trailing Whitespace From A Python String With .rstrip()

Call .rstrip() on a python string to remove any trailing whitespace (including newline characters). For example, this text has both leading and trailing whitespace and newlines. Calling .rstrip() trims the trailing characters while leaving the leading characters in place. For example, this removes the trailing spaces and newlines from the the string while leaving the leading characters alone

August 2021
original = """

    echo foxtrot golf   


right_stripped = original.rstrip()


    echo foxtrot golf|END
═══ § ═══