How to Capitalize String in 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:
main.py
myString = "this is a dog" # String Convert to capitalize capString = myString.capitalize() print(capString);
Output:
This is a dog
I hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- Python Create an Empty Text File Example
- Python String Convert to Lowercase Example
- Python String Convert to Uppercase Example
- Python List Add Element at Beginning Example
- How to Add Element at the End of List in Python?
- Python Convert List into String with Commas Example
- How to Convert List into String in Python?
- Python Split String into List of Characters Example
- How to Convert String into List in Python?
- Python Remove Empty String from List Example
- Python Post Request with Bearer Token Example
- Python Get First Date of Next Month Example
- Python Create Zip Archive from Directory Example