Python Capitalize First Letter
Table of Contents
Hi there, In this tutorial, we will learn about python capitalize first letter. In python programming, capitalization is a method to capitalize on the first word of the sentence. The first word of the sentence is to capitalize whenever this function required.
In python capitalize first letter is the method of capitalization for the first character of the first word of the given sentence. It is mostly used to check the file is Grammarly correct or not. The syntax of the python capitalize first letter is:
Syntax : string.capitalize()
Parameter : For capitalization of first letter, capitalize() method doesn’t take any parameter.
Return Value : The capitalize() method only return the string value with capitalization of the the first letter of the given string.
Examples of python capitalize first letter
#take a sentence without capitalization string = 'this is my home' #capitalize the first character of the sentence string.capitalize()
Output : This is my home
In the above example, The given string is ‘this is my home’, in this string the first word is in lower case. By using capitalize() method the first character of first letter of the sentence can be in the upper case. As you can see in the output of the given example. The output is This is my home.
#take a sentence without capitalization string = 'technoelearn' #capitalize the first character of the sentence string.capitalize()
Output : Technoelearn
As you can see in the above example, The python capitalize first letter are works as the capitalization of only, first letter of the sentence. In Example 2, the given string is technoelearn. By using capitalize() method, the output is Technoelearn. In which the capitalization works for the first letter.
Video Tutorial for python capitalize first letter
How to Capitalize the first letter in python?
Here we will learn, the capitalization of first letter in python. the capitalize() method is used to capitalize the first letter of the sentence. The syntax of capitalization is string.capitalize().
Take a sentence in variable string.
Use capitalize() method for capitalization of first letter of the given string.
For capitalization, use the syntax string.capitalize().
FAQ for Python Capitalize First Letter
What is python capitalization of first letter?
capitalization is the method of capitalizing the first letter of the sentence by using capitalize() method. The syntax of capitalize of the first letter in python is string.capitalize().
How capitalize() method works?
In python programming, The capitalize() method is used to capitalize the first letter of the string. For example, if string = ‘money’ then by using string.capitalize() method the first letter became in uppercase like the output Money.
Learn More Python Programming Language
- Learn more about Find() Method
- Tkinter Python for GUI
- Strip in Python
- List method in Python
- Find() Method in Python
- Clear screen in the python console
- Sequence in Python
- Mod in python
- Substring in python
- Fibonacci Series in Python
If you have any queries regarding python capitalize first letter then ask on the comment section, I am happy to answer your question