How do you add a custom method to a built-in python datatype? For example, I'd like to implement one of the solutions from this question but be able to call it as follows:
>>> s = "A string with extra whitespace"
>>> print s.strip_inner()
>>> A string with extra whitespace
So how would I define a custom .strip_inner()
string method?