main_string.startswith(search_string, start, end)
Returns True if the main string starts with specified search string, otherwise returns False
search_string start end my_str='Welcome to plus2net.com Python section'
output=my_str.startswith('Wel')
print(output) # output is True
my_str='Welcome to plus2net.com Python section'
output=my_str.startswith('co',3)
print(output) # output is True
my_str='Welcome to plus2net.com Python section'
output=my_str.startswith('co',20,24)
print(output) # output is True
Output is here
True
True
True
my_str = "Welcome to plus2net"
print(my_str.startswith("Welcome")) # Output: True
my_str = "Python programming"
print(my_str.startswith("pro", 7)) # Output: True
text = "Data Science and Machine Learning"
print(text.startswith("Science", 5, 15)) # Output: True
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.