[Tutor] str.strip strange result...?

Mark Lawrence breamoreboy at yahoo.co.uk
Fri Jan 15 11:33:50 EST 2016


On 15/01/2016 16:25, Jignesh Sutar wrote:
> #python2.7
>
>>>> s="V01_1"
>>>> s.strip("_1")
> 'V0'
>
> Wouldn't you expect the result to be "V01" ?
>
> Cheers
> Jignesh

No, never expect anything from a given programming language.  What did 
you not understand about this 
https://docs.python.org/3/library/stdtypes.html#str.strip when you read it?

-- 
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