Python Program to Capitalize the First Letter of Each Word Using Regular Expression
# Capitalize the First Letter of Each Word in Python Using Regular expression
import re
def convert_into_uppercase(a):
return a.group(1) + a.group(2).upper()
s = "python is the most popular programming language"
result = re.sub("(^|\s)(\S)", convert_into_uppercase, s)
print(result)
Output:
Python Is The Most Popular Programming Language
About The Author
I have more than 6 years of experience in the IT industry, and I have built a solid foundation in the creation and upkeep of online applications. I have constantly shown strong work ethics, self-motivation, and an aptitude for learning quickly throughout my career.