About 42,700,000 results
Open links in new tab
  1. Python String index() Method - W3Schools

    The index() method finds the first occurrence of the specified value. The index() method raises an exception if the value is not found. The index() method is almost the same as the find() …

  2. How to get the position of a character in Python?

    Feb 19, 2010 · There are two string methods for this, find() and index(). The difference between the two is what happens when the search string isn't found. find() returns -1 and index() raises …

  3. Python String index() Method - GeeksforGeeks

    May 2, 2025 · The index() method in Python is used to find the position of a specified substring within a given string. It is similar to the find() method but raises a ValueError if the substring is …

  4. How to find index of an exact word in a string in Python

    Aug 15, 2016 · Finding the position of a word in a string. You should use regex (with word boundary) as str.find returns the first occurrence. Then use the start attribute of the match …

  5. Python String index(): Locating the Index of a Substring in a String

    In this tutorial, you'll learn how to use the Python string index() method to get the lowest index of a substring in a string.

  6. How to Get Index of a Substring in Python? - GeeksforGeeks

    Nov 20, 2024 · To get index of a substring within a Python string can be done using several methods such as str.find (), str.index (), and even regular expressions. Each approach has its …

  7. Python String index() - Programiz

    The index() method returns the index of a substring inside the string (if found). If the substring is not found, it raises an exception. Example text = 'Python is fun'

  8. Python string index() Method | CodeToFun

    Nov 22, 2024 · The index() method is a built-in string method that allows you to find the index of the first occurrence of a substring within a string. In this tutorial, we'll explore the syntax, …

  9. Python String index() and Find() - pythonpip.com

    Dec 3, 2021 · In this tutorial, we will learn about the Python index () method with the help of examples. I also let you know how to do the same thing using find () method. The index () …

  10. Python: Find an Index (or all) of a Substring in a String

    Sep 23, 2021 · In this post, you’ll learn how to find an index of a substring in a string, whether it’s the first substring or the last substring. You’ll also learn how to find every index of a substring …

Refresh