You can use strip() function on both strings and then "==" will return True. Also, you can use Numpy's char module. It has a function equal() that compares strings by first stripping whitespace characters from the end of the strings.
E.g.
>>> from numpy import char>>> x1='Hello'>>> x2='Hello '>>> x1==x2False>>> x1.strip()==x2.strip()True>>> char.equal(x1,x2)array(True)