Home >>Python String Methods >Python String startswith() Method
Python string startswith() method is used to return True if the string starts with the required value otherwise it will return False.
Syntax:string.startswith(value, start, end)
Parameter | Description |
---|---|
value | This is a required parameter. It defines the value to check if the string starts with. |
start | This is an optional parameter. It defines an Integer specifying at which position to start the search. |
end | This is an optional parameter. It defines an Integer specifying at which position to end the search. |
txt = "Hello, welcome to PHPTPOINT."
x = txt.startswith("Hello")
print(x)
txt = "Hello, welcome to PHPTPOINT."
x = txt.startswith("Hello", 5, 15)
print(x)