Simply use the Python string lower() method to convert every element in a list of strings into lowercase. It will convert given into lowercase letters in Python.
Example make the elements in a list of strings lowercase in Python
Simple python code:
Let’s try, given list
["a", "B", "C"] convert into
["a", "b", "c"].
- Iterate through string_list
- Convert each string to lowercase
strList = ["a", "B", "C"] for i in range(len(strList)): strList[i] = strList[i].lower() print(strList)
Use list comprehension to convert list strings into lowercase words.
strList = ["AA", "BB", "CC"] strList = [x.lower() for x in strList] print(strList)
[‘aa’, ‘bb’, ‘cc’]
Do comment if you have any doubts and suggestions on this Python list code.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.