ibrahim 162

capitalize() cümlenin başındaki harfi büyük yapar

örnek :

txt = "hello, and welcome to my worlds."
x = txt.capitalize()
print (x)

sonuç

Hello, and welcome to my worlds.


casefold() bütün cüledeki kelimeleri küçük yapar

örnek:

txt = "Hello, And Welcome To My World!"

x = txt.casefold()

print(x)

sonuç:

hello, and welcome to my world!


center()   Ortada "banana" olacak şekilde 20 karakterlik boşluk bırakarak "banana"
kelimesini yazdırın:
örnek:

txt = "banana"

x = txt.center(20)

print(x)

sonuç:

banana


count() Belirtilen bir değerin bir dizgede kaç kez oluştuğunu döndürür

örnek:

txt = "I love apples, apple are my favorite fruit"

x = txt.count("apple")

print(x)

sonuç:

2


encode() Dizenin kodlanmış bir sürümünü döndürür

örnek:

txt = "My name is Ståle"

x = txt.encode()

print(x)

sonuç:

b'My name is St\xc3\xe5le'


endwith() Dize belirtilen değerle bitiyorsa true değerini döndürür

örnek:

txt = "Hello, welcome to my world."

x = txt.endswith(".")

print(x)

sonuç:

turu


expandtabs() Dizenin sekme boyutunu ayarlar

örnek:

txt = "H\te\tl\tl\to"

x = txt.expandtabs(2)

print(x)

sonuç:


H e l l o



find() Belirtilen bir değer için dizeyi arar ve bulunduğu konumu döndürür

örnek:

txt = "Hello, welcome to my world."

x = txt.find("welcome")

print(x)

sonuç:

7


format() Belirtilen değerleri bir dizgede biçimlendirir

örnek:

txt = "For only {price:.2f} dollars!"
print(txt.format(price = 49))

sonuç:

For only 49.00 dollars!


format_map() Belirtilen değerleri bir dizgede biçimlendirir

örnek
sonuç:

index() Belirtilen bir değer için dizeyi arar ve bulunduğu yerin konumunu döndürür

örnek:

txt = "Hello, welcome to my world."

x = txt.index("welcome")

print(x)

sonuç:

7


isalnum() Dizedeki tüm karakterler alfasayısal ise True döndürür

örnek:

txt = "Company12"

x = txt.isalnum()

print(x)

sonuç:

true


isalpha() Dizedeki tüm karakterler alfabedeyse True döndürür
örnek:

txt = "CompanyX"

x = txt.isalpha()

print(x)

sonuç:

true


isdecimal() Dizedeki tüm karakterler ondalık ise True döndürür

örnek:

txt = "\u0033" #unicode for 3

x = txt.isdecimal()

print(x)

sonuç:

true


isdigit() Dizedeki tüm karakterler rakam ise True döndürür

örnek:

txt = "50800"

x = txt.isdigit()

print(x)

sonuç:

true


isidentifier() Dize bir tanımlayıcı ise True döndürür

örnek:

txt = "Demo"

x = txt.isidentifier()

print(x)

sonuç:

true


islower() Dizedeki tüm karakterler küçük harf ise True döndürür

örnek:

txt = "hello world!"

x = txt.islower()

print(x)

sonuç:

true


isnumeric() Dizedeki tüm karakterler sayısal ise True döndürür

örnek:

txt = "565543"

x = txt.isnumeric()

print(x)

sonuç:

true


isprintable() Dizedeki tüm karakterler yazdırılabilirse True döndürür


örnek:

txt = "Hello! Are you #1?"

x = txt.isprintable()

print(x)

sonuç:

true



isspace() Dizedeki tüm karakterler boşluksa True döndürür

örnek:

txt = " "

x = txt.isspace()

print(x)

sonuç:

true


istitle() Dize bir başlığın kurallarına uyuyorsa True döndürür

örnek:

txt = "Hello, And Welcome To My World!"

x = txt.istitle()

print(x)

sonuç:

true


isupper() Dizedeki tüm karakterler büyük harf ise True döndürür

örnek:

txt = "THIS IS NOW!"

x = txt.isupper()

print(x)

sonuç:

true


join() Yinelenebilir bir öğenin öğelerini dizenin sonuna birleştirir

örnek:

myTuple = ("John", "Peter", "Vicky")

x = "#".join(myTuple)

print(x)

sonuç:

John#Peter#Vicky


ljust() Dizenin sola dayalı bir sürümünü döndürür

örnek:

txt = "banana"

x = txt.ljust(20)

print(x, "is my favorite fruit.")

sonuç:

banana is my favorite fruit.


lower() Bir dizeyi küçük harfe dönüştürür

örnek:

txt = "Hello my FRIENDS"

x = txt.lower()

print(x)

sonuç:

hello my friends


lstrip() Dizenin soldan kırpılmış sürümünü döndürür

örnek:

('I could eat ', 'bananas', ' all day')txt = " banana "

x = txt.lstrip()

print("of all fruits", x, "is my favorite")

sonuç:

of all fruits banana is my favorite


maketrans() Çevirilerde kullanılacak bir çeviri tablosu döndürür

örnek:

txt = "Hello Sam!"

mytable = txt.maketrans("S", "P")

print(txt.translate(mytable))

sonuç:

Hello Pam!


partition() Dizenin üç parçaya bölündüğü bir tanımlama grubu döndürür

örnek:

txt = "I could eat bananas all day"

x = txt.partition("bananas")

print(x)

sonuç:

('I could eat ', 'bananas', ' all day')


replace() Belirtilen bir değerin belirtilen bir değerle değiştirildiği bir dize döndürür


örnek:

txt = "I like bananas"

x = txt.replace("bananas", "apples")

print(x)

sonuç:

I like apples



rfind() Belirtilen bir değer için dizeyi arar ve bulunduğu son konumu döndürür

örnek:

txt = "Mi casa, su casa."

x = txt.rfind("casa")

print(x)

sonuç:

12


rindex() Belirtilen bir değer için dizeyi arar ve bulunduğu son konumu döndürür

örnek:

txt = "Mi casa, su casa."

x = txt.rindex("casa")

print(x)

sonuç:

12


rindex() Belirtilen bir değer için dizeyi arar ve bulunduğu son konumu döndürür

örnek:

txt = "Mi casa, su casa."

x = txt.rindex("casa")

print(x)

sonuç:

12


rjust() Dizenin sağa dayalı bir versiyonunu döndürür

örnek:

txt = "banana"

x = txt.rjust(20)

print(x, "is my favorite fruit.")

sonuç:

banana is my favorite fruit.


rpartition() Dizenin üç parçaya bölündüğü bir tanımlama grubu döndürür

örnek:

txt = "I could eat bananas all day, bananas are my favorite fruit"

x = txt.rpartition("bananas")

print(x)

sonuç:

('I could eat bananas all day, ', 'bananas', ' are my favorite fruit')


rsplit() Dizeyi belirtilen ayırıcıda böler ve bir liste döndürür

örnek:

txt = "apple, banana, cherry"

x = txt.rsplit(", ")

print(x)

sonuç:

['apple', 'banana', 'cherry']


rstrip() Dizenin sağ kırpılmış sürümünü döndürür

örnek:

txt = " banana "

x = txt.rstrip()

print("of all fruits", x, "is my favorite")

sonuç:

of all fruits banana is my favorite


split() Dizeyi belirtilen ayırıcıda böler ve bir liste döndürür

örnek:

txt = "welcome to the jungle"

x = txt.split()

print(x)

sonuç:

['welcome', 'to', 'the', 'jungle']


splitlines() Satırların sonundaki dizeyi böler ve bir liste döndürür

örnek:

txt = "Thank you for the music\nWelcome to the jungle"

x = txt.splitlines()

print(x)

sonuç:

['Thank you for the music', 'Welcome to the jungle']


startwith() Dize belirtilen değerle başlıyorsa true değerini döndürür

örnek:

txt = "Hello, welcome to my world."

x = txt.startswith("Hello")

print(x)

sonuç:

true


strip() Dizenin kırpılmış bir sürümünü döndürür

örnek:

txt = " banana "

x = txt.strip()

print("of all fruits", x, "is my favorite")

sonuç:

of all fruits banana is my favorite


swapcase() Harfleri değiştirir, küçük harf büyük harf olur ve tam tersi yapar

örnek:

txt = "Hello My Name Is PETER"

x = txt.swapcase()

print(x)

sonuç:

hELLO mY nAME iS peter


title() Her kelimenin ilk karakterini büyük harfe dönüştürür

örnek:

txt = "Welcome to my world"

x = txt.title()

print(x)

sonuç:

Welcome To My World


translate() Çevrilmiş bir dize döndürür

örnek:

#use a dictionary with ascii codes to replace 83 (S) with 80 (P):
mydict = {83: 80}

txt = "Hello Sam!"

print(txt.translate(mydict))

sonuç:

Hello Pam!


üst() Bir dizeyi büyük harfe dönüştürür

örnek:

txt = "Hello my friends"

x = txt.upper()

print(x)

sonuç:

HELLO MY FRIENDS


zfill() Dizeyi başlangıçta belirtilen sayıda 0 değerle doldurur

örnek:

txt = "50"

x = txt.zfill(10)

print(x)

sonuç:

0000000050

Add to: