Odd strip behavior

Ian Kelly ian.g.kelly at gmail.com
Thu Mar 22 21:06:21 CET 2012


On Thu, Mar 22, 2012 at 1:48 PM, Rodrick Brown <rodrick.brown at gmail.com> wrote:
> Why wasnt the t removed ?

Because str.strip() only removes leading or trailing characters.  If
you want to remove all the t's, use str.replace:

'this is a test'.replace('t', '')

Cheers,
Ian



More information about the Python-list mailing list