Capitalize the First Character of a String in Python Using str.title()

(Last Updated On: 11/10/2023)

Python Program to Capitalize the First Character of a String Using str.title() Function

#Capitalize the First Character of a String Using str.title() method in python

s = "python"
print("Original string: " +s) 

#string.title() method is a very simple and straightforward method of generating titles for strings.
print("After capitalizing the first letter: " +str.title(s))

Output:

Original string: python
After capitalizing the first letter: Python

Leave a Reply

Your email address will not be published. Required fields are marked *