title | description | author | tags |
---|---|---|---|
Capitalize Words |
Capitalizes the first letter of each word in a string. |
axorax |
string,capitalize |
def capitalize_words(s):
return ' '.join(word.capitalize() for word in s.split())
# Usage:
capitalize_words('hello world') # Returns: 'Hello World'