Common treatment methods python string

  Common treatment methods python string

method Instructions for use method Instructions for use
string[start:end:step] Slice string string.replace The replacement string
string.split Split string of sep.jojin   The iterables by a string of splicing sep delimiter
string.strip Delete from beginning to end blank string.lstrip Delete string left blank
string.rstrip The right to delete blank string string.count Counting string string
string.index Returns the position of the first occurrence of the substring string.find

Returns the position of the first occurrence of the string (not found returns -1)

string.startwith What if the string to begin with string.endwith What if a string to the end

 

Guess you like

Origin www.cnblogs.com/tinglele527/p/11686548.html