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:
>>> A = '000000' >>>. strip () '000000' >>> a = '\ t \ tabc' 'ABC' >>> a = 'sdff \ r \ n' >>>. 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:
>>> A = '123abc' >>> a. strip ('21') '3abc' returns the same result >>> a. strip ('12') '3abc'
For more articles about the python strip () function, refer to the Chinese PHP website!