You can download this code by clicking the button below.
This code is now available for download.
This function takes an input string, capitalizes the first letter of each word in the string, and returns the modified string.
Technology Stack : String split, string join, string capitalize
Code Type : String processing
Code Difficulty : Beginner
def capitalize_words(input_string):
"""
将输入字符串中的每个单词的首字母大写。
"""
return ' '.join(word.capitalize() for word in input_string.split())