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
🎥 Join me live on YouTubePassionate about coding and teaching, I publish practical tutorials on PHP, Python, JavaScript, SQL, and web development. My goal is to make learning simple, engaging, and project‑oriented with real examples and source code.