Pythonstrip () function introduction. if you need it, refer to the 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:
The 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:
The code is as follows:
>>> A = '123abc'
>>> A. strip ('21 ')
'3abc' results are the same
>>> A. strip ('12 ')
'3abc'