Python String Find() Method

Python String Find( ) Method

  • The find( ) method returns -1 if the sub string is not found in the main string.

  • The find( ) method return only the first occurrence of the sub string.

Syntax

  • string.find(value, start, end) 

Parameter                     

value

                              Required. The value to search for

start

                              Optional. Where to start the search. Default is 0

end

                               Optional. Where to end the search. Default is to the end of the string

 

Comments