[Tutor] String method "strip()" not working
Mark Lawrence
breamoreboy at yahoo.co.uk
Sat Mar 7 16:17:33 CET 2015
On 07/03/2015 14:54, Alan Gauld wrote:
> On 07/03/15 13:15, Akash Shekhar wrote:
>> I am trying to learn how to use strip() method. It is supposed to cut out
>> all the whitespace as I read in the tutorial.
>
> Read it again more closely.
>
> -------------------
> Help on built-in function strip:
>
> strip(...)
> S.strip([chars]) -> string or unicode
>
> Return a copy of the string S with leading and trailing
> whitespace removed.
> If chars is given and not None, remove characters in chars instead.
> If chars is unicode, S will be converted to unicode before stripping
Presumably Python 2 (or earlier Python 3) help output. In Python 3
strings are always unicode, so that last line has gone.
--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.
Mark Lawrence
More information about the Tutor
mailing list