[Tutor] creating the equivalent of string.strip()
cspears2002 at yahoo.com
Sat Sep 29 06:55:44 CEST 2007
I'm working out of chapter 6 of Core Python
Programming (2nd Edition). For one problem, I am
supposed to write a script that is the equivalent of
string.strip(). Obviously, using any version of
string.strip() defeats the purpose of the exercise.
I'm not sure how to proceed. My biggest stumbling
block is how to detect the leading and trailing
whitespace. If I wanted to remove all whitespace in a
string, I would probably break the string into its
individual components, cycle through the string,
detect the whitespace, and remove them. Any hints?
More information about the Tutor