How to Convert List to Lowercase in Python?
Nov 03, 2022
Hi Dev,
This article will give you example of How to Convert List to Lowercase in Python. Here you will learn How to Convert List Elements to Lowercase in Python. In this article, we will implement a How to Convert List to Lowercase in Python. you will learn Convert List Data to Lowercase Python. Alright, let’s dive into the steps.
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.
so let's see following examples 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']
- Get Last 2 Digits of Number in Python Tutorial Example
- How to Sum of First and Last Digit of Number in Python?
- How to Get First and Last Digit of Number in Python?
- Get the Last Digit of Number in Python Tutorial Example
- Get the First Digit of Number in Python Tutorial Example
- How to Remove All Decimals from Number in Python?
- How to Convert String to Float with 2 Decimal Places in Python?
- How to Format Number to 2 Decimal Places in Python?