DEV Community

Ozodbek Tohirov
Ozodbek Tohirov

Posted on Edited on

Python'da title() method'i nima?

Sintaksis

string.title()
Enter fullscreen mode Exit fullscreen mode

Misollar

  1. Title() method'i har bir so'zdagi birinchi belgisini katta bo'lgan string sifatida qaytaradi.
txt = "Welcome to my world"

x = txt.title()

print(x)
Enter fullscreen mode Exit fullscreen mode

natija:

# Welcome To My World
Enter fullscreen mode Exit fullscreen mode
  1. Agar so'zda raqam yoki simbo'l bo'lsa, undan keyingi birinchi harf Uppercase(katta harf)ga aylantiriladi.
txt = "w1w2w3 Wel1come 1 to my 1world"
x = txt.title()
print(x)
Enter fullscreen mode Exit fullscreen mode

natija:

# W1W2W3 Wel1Come 1 To My 1World
Enter fullscreen mode Exit fullscreen mode

Top comments (0)