Python String endswith() Method
Python endswith() method returns true of the string ends with the specified substring, otherwise returns false.
Start and end both parameters are optional.
It returns a boolean value either True or False.
Let's see some examples to understand the endswith() method.
Python String endswith() Method Example 1
A simple example which returns true because it ends with dot (.).
Python String endswith() Method Example 2
It returns false because string does not end with is.
Python String endswith() Method Example 3
Here, we are providing start index of the range from where method starts searching.
Python String endswith() Method Example 4
It returns true because third parameter stopped the method at index 13.
JavaTpoint offers too many high quality services. Mail us on [email protected], to get more information about given services.
JavaTpoint offers college campus training on Core Java, Advance Java, .Net, Android, Hadoop, PHP, Web Technology and Python. Please mail your requirement at [email protected].
Duration: 1 week to 2 week