PYTHON
Capitalize first letter in python
s = "python"
print("Original string:")
print(s)
print("After capitalizing first letter:")
print(s.capitalize())
how to capitalize first letter in python
# To capitalize the first letter in a word or each word in a sentence use .title()
name = tejas naik
print(name.title()) # output = Tejas Naik
capitalize first letter of each word python
"hello world".title()
'Hello World'
>>> u"hello world".title()
u'Hello World'
python capitalize first letter of each word in a string
>>> "hello world".title()
'Hello World'
>>> u"hello world".title()
u'Hello World'
python lowercase first letter
def decapitalize(str):
return str[:1].lower() + str[1:]
print( decapitalize('Hello') ) # hello
python first letter to capitalize
my_string = "programiz is Lit"
cap_string = my_string.capitalize()
print(cap_string)
python starts with capital letter
In [48]: x = 'Linux'
In [49]: x[0].isupper()
Out[49]: True
In [51]: x = 'lINUX'
In [53]: x[0].isupper()
Out[53]: False
python string first letter uppercase and second letter in lowercase
x = "string"
y = x[:3] + x[3].swapcase() + x[4:]
capitalize first letter of each word python
# Use title() to capitalize the first letter of each word in a string.
name = "elon musk"
print(name.title())
# Elon Musk
how to make a letter capital in python
s = "hello openGeNus"
t = s.title()
print(t)
PythonCopy
python first letter to capitalize
my_string = "programiz is Lit"
print(my_string[0].upper() + my_string[1:])
capitalizing first letter of each word in python
text = "this is an example text"
print(text.title())