Skip to content

How to make all items in a list lowercase Python | Example code

  • by

Use the string lower() method to convert every element in a list of strings into lowercase in Python. Python list variable that contains strings needed to iterate through the loop and add back lowercase value into a list.

Make all items in a list lowercase example in Python

Simple python example code.

Using a lower() method with Loop

Use a Python for loop to iterate through each time in a list of strings by index. Then use str.lower() method on each string and reassign it to the corresponding index in the list for that string.

list1 = ["A", "B", "C"]

for i in range(len(list1)):
    list1[i] = list1[i].lower()

print(list1)

Output:

How to make all items in a list lowercase Python

Another example use a list comprehension

It’s a more compact implementation.

[x.lower() for x in ["A", "B", "C"]]

Example code

list1 = ["A", "B", "C"]

list1 = [each_string.lower() for each_string in list1]

print(list1)

One more example with the map function


list1 = list(map(lambda x: x.lower(), ["A", "B", "C"]))

print(list1)

Do comment if you have any doubts and suggestions on this Python list code.

Note: IDE: PyCharm 2021.3.3 (Community Edition)

Windows 10

Python 3.10.1

All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.

Leave a Reply

Discover more from Tutorial

Subscribe now to keep reading and get access to the full archive.

Continue reading