{"id":24770,"date":"2021-11-02T09:46:33","date_gmt":"2021-11-02T04:16:33","guid":{"rendered":"https:\/\/python-programs.com\/?p=24770"},"modified":"2021-11-05T19:16:35","modified_gmt":"2021-11-05T13:46:35","slug":"python-string-find-method-with-examples","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-string-find-method-with-examples\/","title":{"rendered":"Python String find() Method with Examples"},"content":{"rendered":"

In the previous article, we have discussed Python String expandtabs() Method with Examples<\/a>
\nString find() Method in Python:<\/strong><\/p>\n

The find() method looks for the first instance of the specified value.<\/p>\n

If the value cannot be found, the find() method returns -1.<\/p>\n

The find() method is nearly identical to the index() method, with the exception that the index() method throws an exception if the value is not found.<\/p>\n

Syntax:<\/strong><\/p>\n

string.find(value, start, end)<\/pre>\n

Parameters<\/strong><\/p>\n

value:<\/strong> This is Required. It is a string. The value to look for in the string.<\/p>\n

start:<\/strong>\u00a0This is optional. It is an integer. The starting point for the search. The default value is 0.<\/p>\n

end:<\/strong>\u00a0This is optional. It is an integer. The ending point for the search. The default value is the end of the string.<\/p>\n

Return Value:<\/strong><\/p>\n

The find() method gives the following integer value:<\/p>\n