On 02/11/06, Chris Hengge <[EMAIL PROTECTED]> wrote:
> I can't figure out a way to .strip("string")
>
> Example might look like this:
>
> >>> 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.

eg:
>>> myStr = 'my words are what I want to strip'
>>> print myStr.strip('my')
 words are what I want to strip

You can use .replace() to be more general.

>>> myStr = 'I want to strip my words'
>>> print myStr.replace('my', '')
I want to strip  words

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

Reply via email to