You can use the "strip()" method to remove whitespace characters from the beginning and end of a string in Python.