John Fouhy schrieb: > On 02/11/06, Chris Hengge <[EMAIL PROTECTED]> wrote: >>>>> myStr = "I want to strip my words." >>>>> print myStr.strip("my") >>>>> 'I want to strip words.' > > .strip() only removes text from the beginning and end of the string.
It is generally used to remove whitespace from the start/end of a string, e.g. removing the newline character from the end of a line of text. But you can also specify which characters to strip. Note that the argument is not a string to strip off, but rather a collection of characters, any of which should be stripped off, e.g. >>> r = "I want to strip my words." >>> r.strip('I. ') # note the space 'want to strip my words' Chris _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor