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)

Billboard image

Create up to 10 Postgres Databases on Neon's free plan.

If you're starting a new project, Neon has got your databases covered. No credit cards. No trials. No getting in your way.

Try Neon for Free →

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay