ItSolutionStuff.com

How to Convert List to Capitalize First Letter in Python?

By Hardik Savani • October 30, 2023
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...

Tags: Python
Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

How to Convert List to Uppercase in Python?

Read Now →

Python Convert List into String with Commas Example

Read Now →

How to Convert List to Lowercase in Python?

Read Now →

How to Convert List into String in Python?

Read Now →

Python Split String into List of Characters Example

Read Now →

How to Convert String into List in Python?

Read Now →

How to Remove Duplicate Values from List in Python?

Read Now →

How to Get the Last Element of a List in Python?

Read Now →

How to Remove Last Element from List in Python?

Read Now →

How to Remove First Element from List in Python?

Read Now →

Python List Remove Element by Value Example

Read Now →

Python Delete Folder and Files Recursively Example

Read Now →

How to Get Current Date and Time in Python?

Read Now →