Capitalize every word

Python, String · Nov 2, 2020

Capitalizes the first letter of every word in a string.

  • Use str.title() to capitalize the first letter of every word in the string.
def capitalize_every_word(s):
  return s.title()
capitalize_every_word('hello world!') # 'Hello World!'

More like this

  • Capitalize string

    Capitalizes the first letter of a string.

    Python, String · Nov 2, 2020

  • Decapitalize string

    Decapitalizes the first letter of a string.

    Python, String · Nov 2, 2020

  • String to words

    Converts a given string into a list of words.

    Python, String · Nov 2, 2020