Short function to remove unnecessary whitespace
I think the shorter, the better. Since you are in Python 3, if you really want to make explicit that the function is returning a string, you can use type hints:

def trimString(string) -&gt; str:


You can also specify it in the parameter:

def trimString(string: str) -&gt; str:


(keep in mind that Python will ignore type hints, but some IDEs like PyCharm use it to detect warnings and errors)

On a side note, you should try to follow the PEP 8 styling conventions; the function name should be in camel case, so trim_string.