import stringbadSentence = "\t\tThis sentence has problems. "#Strip trailing spacesprint "Length = " + str(len(badSentence))print "Without trailing spaces = " + str(len(badSentence.rstrip(' ')))