This is exactly as expected.


Strip removes any of the characters in the passed string from both the front and the end of the string being stripped.

The letter 'T' from the start of 'The meaning of life' does not appear in the word 'meaning' so nothing is removed from the start of the string.


The letter 'e' from the end of 'The meaning of life' does appear in the word 'meaning' so it is removed from the sentence; it will then look at the next last letter 'f', but since this doesn't appear in the word 'meaning' nothing else is removed and the new string is returned.

The argument passed to strip(..) method is the set of characters to be removed - so any characters in that set are removed from the start and end of the string.




------ Original Message ------
From: "Jeff Jeffi" <infojm...@gmail.com>
To: d...@python.org
Cc: python-list@python.org
Sent: Wednesday, 4 May, 22 At 10:36
Subject: [docs] Reporting a Bug

Hello dears,

First of all i am not sure about this issue please advise me if there is any mistake in my report.


 for example in python 3.6.3 shell:


x= "The meaning of life" x.strip("meaning")
'The meaning of lif'


As you see the letter "e" of  the word "life"  is removed.


Sincerely yours.
J.Mohammadi




 _______________________________________________
docs mailing list -- d...@python.org
To unsubscribe send an email to docs-le...@python.org
https://mail.python.org/mailman3/lists/docs.python.org/ <https://mail.python.org/mailman3/lists/docs.python.org/>
Member address: anthony.fl...@btinternet.com

-- <br>Anthony Flury<br>anthony.fl...@btinternet.com
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to