Python String startwith() Yöntemi
Örnek
Dizenin "Merhaba" ile başlayıp başlamadığını kontrol edin:
txt = "Hello, welcome to my world."
x = txt.startswith("Hello")
print(x)
Tanım ve Kullanım
Dize belirtilen startswith()
değerle başlıyorsa yöntem True, değilse False değerini döndürür.
Sözdizimi
string.startswith(value, start, end)
Parametre Değerleri
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 |
Daha fazla örnek
Örnek
7 ila 20 konumunun "wel" karakterleriyle başlayıp başlamadığını kontrol edin:
txt = "Hello, welcome to my world."
x = txt.startswith("wel",
7, 20)
print(x)