Capitalize the First Letter of Every Word in the File Using title() in Python

(Last Updated On: 11/10/2023)

Python Program to Capitalize the First Letter of Every Word in the File Using title() Function

#Python Program to Capitalize the First Letter of Every Word in the File Using title()

file = open('readme.txt', 'r')
for line in file: 
    output = line.title()
    print(output)

Output:

Hello World

Leave a Reply

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