Python Convert List to Lowercase Example Tutorial

Published On: 23/11/2022 | Category: Python


Hi Guys,

This article will give you example of python convert list values to lowercase. this example will help you python convert list to lowercase example tutorial. I explained simply about convert list elements to lowercase python. you will learn convert list data to lowercase python. Let's see bellow example convert list to lowercase python.

Python has a variety of methods for changing list components to lowercase. I'll give you two examples of how to lowercase data from a list using a for loop and the lower() function. Check out the examples below.

So let's see bellow example:

Example 1:

main.py
myList = ['One', 'TWO', 'Three']
  
# Convert List Value into lowercase
for i in range(len(myList)):
    myList[i] = myList[i].lower()
  
print(myList)
Output
['one', 'two', 'three']

Example 2:

main.py
myList = ['One', 'TWO', 'Three']
  
# Convert List Value into lowercase
newList = [x.lower() for x in myList]
  
print(newList)
Output
['one', 'two', 'three']

It will help you....

Happy Pythonic Coding!