Does anyone know of a really simple way of capitalizing just the first letter of a string, regardless of the capitalization of the rest of the string?
For example:
this actually gives you a capitalized word, instead of just capitalizing the first letter
cApItAlIzE -> Capitalize
def capitalize(str):
return str[:1].upper() + str[1:].lower().......
>>> b = "my name"
>>> b.capitalize()
'My name'
>>> b.title()
'My Name'
What about your_string.title()
?
e.g. "banana".title() -> Banana