"wesley chun" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> > I'm not sure how to proceed. My biggest stumbling >> > block is how to detect the leading and trailing >> > whitespace. >> >> Use indexing. >> Try using a while loop. >> Or maybe two? >> >> And strings have an isspace method... > > unfortunately, the isspace() string method only returns True if all > chars in the string are whitespace chars and False otherwise, so > that's a bummer.
But the string can be one character long: s = 'fred\n' print s[-1].isspace() # --> True :-) Alan G _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor