Capitalize String in Python Example

13-Dec-2022

.

Admin

Capitalize String in Python Example

Hi Dev,

This post will give you example of capitalize string in python example. you will learn how to use string capitalize in python. I explained simply step by step python string capitalize example. you will learn python string capitalize example.

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.

so let's see following examples with output:

Example :


main.py

myString = "this is a dog"

# String Convert to capitalize

capString = myString.capitalize()

print(capString);

Output:

This is a dog

#Python