How do I remove whitespace from the end of a string in Python? December 11, 2022 by Tarik >>> " xyz ".rstrip() ' xyz' There is more about rstrip in the documentation.