About Lesson
startswith():-
The startswith() method returns True if the string starts with the specified value, otherwise False.
Syntax:- string.startswith(value, start, end)
|
Parameter |
Description |
|
value |
Required. The value to check if the string starts with |
|
start |
Optional. An Integer specifying at which position to start the search |
|
end |
Optional. An Integer specifying at which position to end the search |
|
txt = “Hello, welcome to my world.” x = txt.startswith(“Hello”) print(x) Output True |
txt = “Hello, welcome to my world.” x = txt.startswith(“wel”, 7, 20) print(x) Output True |