"Christopher Spears" <[EMAIL PROTECTED]> wrote

> I decided to post a solution to this problem that uses
> regular expressions.
> 
> def my_strip(s):
>    remove_leading = re.sub(r'^\s+','',s)
>    remove_trailing =
> re.sub(r'\s+$','',remove_leading)
>    new_s = remove_trailing
>    return new_s

You can replace the last two lines with 

return remove_trailing

There is no need for new_s
(In fact you could just return the last sub result 
and dispense with remove_training too!)

Alan G.

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to