1. Description of the Python find() method
The Python find() method applied to a character string returns the smallest index of the substring if it is in this string. If the substring is not found, it returns -1.
2. Syntax
string. find(str, beg=0, end=len(string))
3. Parameters
- string: This specifies the string to search for.
- beg: This is the start index, default is 0.
- end: This is the end index, by default it is equal to the length of the string.
3. Return value
Index where the substring is found and -1 otherwise.
Example
str1 = "Python is the most popular programming language"
str2="th"
print(str1.find(str2)) # displays: 2
print(str1.find(str2, 7)) # displays: 10
print(str1.find(str2, 47)) # displays: -1
print(str1.find(str2 , 5 , 31)) # displays: 10
Younes Derfoufi
my-courses.net
my-courses.net
When might have} exhausted this reward, you’ll be able to|be succesful of|have the flexibility to} get pleasure from a variety of|quite a lot of|a wide selection of} ongoing provides, together with ones that embrace free spins. Sign-up bonus model spanking new|for model new} customers solely and will solely 점보카지노 apply quickly as} per account/person. Thai police additionally discovered two name centre-type operations working scams concentrating on victims in Korea. The suspects would trick the victims into disclosing their checking account information then withdraw cash from the accounts, stealing an estimated USD 200,000.