Copyright © tutorialspoint.com

# Python String find() Method

## Description:

This method determines if str occurs in string, or in a substring of string if starting index beg and ending index end are given.

## Syntax:

    str.find(str, beg=0 end=len(string))

## Parameters:

Here is the detail of parameters:

- str: specifies the string to be searched.

- start : starting index, by default its 0

- end : ending index, by default its equal to the lenght of the string.

## Return Value:

It returns index if found and -1 otherwise.

## Example:

    #!/usr/bin/python

    str1 = "this is string example....wow!!!";
    str2 = "exam";

    print str1.find(str2);
    print str1.find(str2, 10);
    print str1.find(str2, 40);

This will produce following result:

    15
    15
    -1

Copyright © tutorialspoint.com