xxxxxxxxxx
my_string = "car"
my_string.upper() # Makes EVERY letter uppercase
print(my_string)
>>> "CAR"
my_string = "car"
my_string.title() # Makes ONLY FIRST letter uppercase and others lowercase
print(my_string)
>>> "Car
xxxxxxxxxx
my_string = "programiz is Lit"
cap_string = my_string.capitalize()
print(cap_string)
xxxxxxxxxx
>>> "hello world".title()
'Hello World'
>>> u"hello world".title()
u'Hello World'
xxxxxxxxxx
my_string = "programiz is Lit"
print(my_string[0].upper() + my_string[1:])
xxxxxxxxxx
import camelcase
c = camelcase.CamelCase()
txt = "Welcome Dear ismail "
print(c.hump(txt))
xxxxxxxxxx
"hello world".title()
'Hello World'
>>> u"hello world".title()
u'Hello World'
xxxxxxxxxx
def n_upper_chars(string):
return sum(map(str.isupper, string))
xxxxxxxxxx
# Use title() to capitalize the first letter of each word in a string.
name = "elon musk"
print(name.title())
# Elon Musk