[Tutor] String method "strip()" not working

Akash Shekhar akash.shekhar121 at gmail.com
Sat Mar 7 14:15:32 CET 2015


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. But the code is not working.

Here's my code:

sentence = "Hello, how are you?"
>
>
>> print(sentence)
>
>
>> print(sentence.strip())
>
>
>> input("\n\nPress enter key to exit.")
>
>
>
Here's it's output:

Hello, how are you?
> Hello, how are you?
>
> Press enter key to exit.
>


Both results are same.

P.S.: I am using Python 3.1 IDLE on Windows 7.


More information about the Tutor mailing list