How to Capitalize String in Python?

By Hardik Savani October 30, 2023 Category : Python

Hello Developer,

In this example, I will show you how to capitalize string in python. you can see how to capitalize first letter in python. This tutorial will give you a simple example of python string capitalize example. I explained simply about python string capitalize example. you will do the following things for how to use string capitalize in python.

There is a way to convert a string into capitalizing in python. i will give you one example using capitalize() method to python capitalize first letter of sentence. so let's see the below examples.

You can use these examples with python3 (Python 3) version.

let's see below a simple example with output:

Example 1:

myString = "this is a dog"
# String Convert to capitalize
capString = myString.capitalize()


This is a dog

I hope it can help you...

Tags :