How to apply function lower() to the list? - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: General Coding Help (https://python-forum.io/forum-8.html) +--- Thread: How to apply function lower() to the list? (/thread-39386.html) |
How to apply function lower() to the list? - Toltimtixma - Feb-10-2023 Hi, everyone! I have a list with the names of users: users = ['Timoteusz', 'MAD', 'GaMer', 'ToXIC',....] All the names are in different letter case. How to apply function lower() to the copy of this list to make all the names lowercase? RE: How to apply function lower() to the list? - buran - Feb-10-2023 users = ['Timoteusz', 'MAD', 'GaMer', 'ToXIC'] # using list comprehension users_lower = [item.lower() for item in users] # using map users_lower2 = list(map(str.lower, users)) print(users_lower) print(users_lower2) RE: How to apply function lower() to the list? - Toltimtixma - Feb-10-2023 Thanks! Super! It works! |