1/7
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
string_name.count(‘substring’)
Returns the number of times its substring occurs in the string. Optionally takes start index and end index to search a substring of the string.
string_name.count(‘substring’, start_index)
count searches only the slice string[start_index:]—that is, from start_index through end of the string
string_name.count(‘substring’, start_index, end_index)
count searches only the slice string[start_index:end_index]—that is, from start_index up to, but not including, end_index
string_name.index(‘substring’)
Searches from the beginning of the string and returns the first index at which a substring is found; raises ValueError if not found.
string_name.rindex(‘substring’)
Searches from the end of the string and returns the first index of the substring; raises ValueError if not found.
‘substring’ in string_name
Returns True if the string does contain the substring.
string_name.startswith(‘substring’)
Returns True if the string starts with the specified substring.
string_name.endswith(‘substring’)
Returns True if the string ends with the specified substring.