Python string search operation

Python string search operation

1.count function, return the number of repeated strings in the parameter (no overlap)
Insert picture description here
2.find () find the first place where the parameter string appears from the left, if not, return -1
Insert picture description here
3.rfind () find the first time from the right Where there is a parameter string, if not, return -1
Insert picture description here
4. startwith () to determine whether the string begins with the parameter string, yes, return true, otherwise return false
Insert picture description here
5.endswith () to determine whether the string ends with the parameter string, Yes, return true, otherwise return false
Insert picture description here

Published 28 original articles · praised 0 · visits 619

Guess you like

Origin blog.csdn.net/qq_44932835/article/details/105474781