Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22050

Re: Odd strip behavior

References <5B2CBFB0-DC2D-47E1-978F-59E47EB3A757@gmail.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date 2012-03-22 14:06 -0600
Subject Re: Odd strip behavior
Newsgroups comp.lang.python
Message-ID <mailman.909.1332446814.3037.python-list@python.org> (permalink)

Show all headers | View raw


On Thu, Mar 22, 2012 at 1:48 PM, Rodrick Brown <rodrick.brown@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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Odd strip behavior Ian Kelly <ian.g.kelly@gmail.com> - 2012-03-22 14:06 -0600

csiph-web