Tag: Split expression specifies regular log pos space out character
1.strip (): Remove the blanks from the head and tail
2.lstrip (): Remove the left space
3.rstrip (): Remove the space on the right
4.replace (' C1 ', ' C2 '): Replace the C1 in the string with C2. So you can use replace (",") to remove all the spaces in the string.
5.split (): The string is sliced by specifying a delimiter, and only the NUM substring is delimited if the parameter num has a specified value
IN[2]: a='ddd DfE DFD efre ddd'in[3]: aout[3]:'ddd DfE DFD efre ddd'in[4]: A.strip () out[4]:'ddd DfE DFD efre ddd'in[5]: A.lstrip () out[5]:'ddd DfE DFD efre ddd'in[6]: A.rstrip () out[6]:'ddd DfE DFD efre ddd'in[7]: A.replace (' ',"') out[7]:'ddddfedfdefreddd'in[8]: A.split () out[8]: ['DDD','DfE','DFD','Efre','DDD']
6. Using Regular expressions
Re.split (R'\s+"a b c') ['a ' ' b ' ' C ']
Python's method of removing a hollow lattice of strings