How to Convert List to Capitalize First Letter in Python?
Hey,
Are you looking for an example of python list convert to capitalize first letter. I would like to show you capitalize the first letter of each word. you'll learn python list convert to title case. you will learn convert list to title case python. Let's see below example python list convert into capitalize title example.
There are many ways to convert list elements to capitalize first letter in python. i will give you two examples using for loop with title() to convert list data to capitalize first letter. 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
myList = ['one', 'two', 'three'] # Convert List Value into capitalize for i in range(len(myList)): myList[i] = myList[i].title() print(myList)
Output:
['One', 'Two', 'Three']
Example 2:
main.py
myList = ['one', 'two', 'three'] # Convert List Value into capitalize newList = [x.title() for x in myList] print(newList)
Output:
['One', 'Two', 'Three']
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
- How to Convert List to Uppercase in Python?
- Python Convert List into String with Commas Example
- How to Convert List to Lowercase in Python?
- How to Convert List into String in Python?
- Python Split String into List of Characters Example
- How to Convert String into List in Python?
- How to Remove Duplicate Values from List in Python?
- How to Get the Last Element of a List in Python?
- How to Remove Last Element from List in Python?
- How to Remove First Element from List in Python?
- Python List Remove Element by Value Example
- Python Delete Folder and Files Recursively Example
- How to Get Current Date and Time in Python?