[Notes] on the Python strip () function removes appreciated string

Python strip () method for removing head and tail of the specified character string (line feed spaces or default) or character sequence.

Note: This method can only delete the beginning or end of the character, the character can not be deleted middle part.

Example:

Has been previously understood to be end to end '12' was removed, only later to be understood to know: strip the filter is split into a string of characters, the characters one by one and then filtered and trailing

It is simply:

De novo look: The first character '1' is contained in the '12' in the removed; second character "2" is contained in the '12' in the removed; third character '3' is not contained in the '12' was not removed, and stop there;

From the point of view tail: a penultimate character '1' is contained in the '12' in the removed; penultimate character '2' is contained in the '12' in the removed; antepenultimate characters '3' is free in the '12' was not removed, and stop there;

Guess you like

Origin www.cnblogs.com/xiaoxin-test/p/11459183.html