Function prototype
Declaration: "s" is a string and "rm" is the sequence of characters to be deleted.
S. strip (rm) Delete the characters starting and ending in the s string and located in the rm Delete Sequence
S. lstrip (rm) Delete the characters starting from the s string in the rm Delete Sequence
S. rstrip (rm) deletes the characters at the end of the s string in the rm deletion sequence.
Note:
1. When rm is blank, blank spaces (including '\ n',' \ R', '\ t', '') are deleted by default ','')
For example:
Copy codeThe Code is as follows: >>> a = '000000'
>>> A. strip ()
'123'
>>> A = '\ t \ tabc'
'Abc'
>>> A = 'sdff \ r \ N'
>>> A. strip ()
'Sdff'
2. Here, the rm Delete sequence is deleted as long as the characters on the edge (beginning or end) are in the delete sequence.
For example:
Copy codeThe Code is as follows: >>> a = '123abc'
>>> A. strip ('21 ')
'3abc' results are the same
>>> A. strip ('12 ')
'3abc'