How to Convert List to Lowercase in Python?
In this tutorial, I will show you python convert list values to lowercase. In this article, we will implement a convert list to lowercase python. if you want to see an example of convert list elements to lowercase python then you are in the right place. I would like to show you convert list data to lowercase python.
There are many ways to convert list elements to lowercase in python. i will give you two examples using for loop with lower() to convert list data to lowercase. 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 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']
I hope it can help you...