PythonStringstartswith
index

startswithString

endswith

Returns True if the string starts with the specified prefix.

Syntax

str.startswith(prefix, start?, end?)

Example

Enter values below to update the example in real time.

url
print
startswith
url = "https://example.com"
print(url.startswith("https"))   # True
print(url.startswith("http://")) # False