Python String endwith() Yöntemi
Örnek
Dizenin bir noktalama işaretiyle (.) bitip bitmediğini kontrol edin:
txt = "Hello, welcome to my world."
x = txt.endswith(".")
print(x)
Tanım ve Kullanım
Dize belirtilen endswith()
değerle biterse yöntem True, aksi takdirde False döndürür.
Sözdizimi
string.endswith(value, start, end)
Parametre Değerleri
Parameter | Description |
---|---|
value | Required. The value to check if the string ends 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
Dizenin "benim dünyam" ifadesiyle bitip bitmediğini kontrol edin:
txt = "Hello, welcome to my world."
x = txt.endswith("my world.")
print(x)
Örnek
5 ila 11 arasındaki konumun "benim dünyam" ifadesiyle bitip bitmediğini kontrol edin:
txt = "Hello, welcome to my world."
x = txt.endswith("my world.",
5, 11)
print(x)