capitalize first letter in string python code example
Example 1: capitalize first letter of each word python
"hello world".title()
'Hello World'
>>> u"hello world".title()
u'Hello World'
Example 2: python capitalize first letter of string without changing the rest
string[0].upper() + string[1:]
Example 3: python lowercase first letter
def decapitalize(str):
return str[:1].lower() + str[1:]
print( decapitalize('Hello') ) # hello