It may be a bit late to answer this, but if you are looking for a library function, not an instance method, you can also use it. Just use:
yourunicodestring = u' a unicode string with spaces all around ' unicode.strip(yourunicodestring)
In some cases, it is easier to use, for example, inside a display function, for example:
unicodelist=[u'a',u' a ',u' foo is just...foo '] map (unicode.strip,unicodelist)
source share