About 2,870,000 results
Open links in new tab

Got it, one moment

...
Feedback
AI generated code. Review and use carefully. More info on FAQ.
  1. python - Convert a list with strings all to lowercase or uppercase ...

    Code sample

    >>> list(map(lambda x: x.lower(), ["A", "B", "C"]))
    ['a', 'b', 'c']
    >>> list(map(lambda x: x.upper(), ["a", "b", "c"]))
    ['A', 'B', 'C']
    I have a Python list variable that contains strings. Is there a function that can convert all the strings in one pass to lowercase and vice versa, uppercase?
    ✓ It can be done with list comprehensions >>> [x.lower() for x in ["A", "B", "C"]] ['a', 'b', 'c'] >>> [x.upper() for x in ["a", "b", "c"]] ['A', 'B', 'C'] or with the map fu…
    Feedback
  2. Capitalize Each String in a List of Strings in Python

    Mar 13, 2024 · Below, are the methods of Capitalize Each String In A List Of Strings In Python. Using a For Loop Using List Comprehension; Using Map Function; Using join() Method; Using …

  3. How to uppercase first letter in a Python list [6 Methods] - Python …

      1. Python uppercase first letter in a list using List comprehension. The list …
      2. Python uppercase first letter in a list using map() function. Similar to the first …
      3. Capitalize the First Letter of an Element in a List in Python. In cases where …
      4. How to uppercase the first letter in a Python list using title() function. The …
      5. Capitalize first character of the items in a Python list using for loop. This …
  4. How to capitalize elements in list Python | Example code - EyeHunts

    Jul 13, 2021 · Use string upper () method to convert every element in a list of strings into uppercase (capitalize) in Python code.

  5. How to Capitalize the First Letter of Every Word in a List using …

    Feb 25, 2025 · Learn how to capitalize the first letter of every word in a list using Python with `title()`, `capitalize()`, and list comprehension along with examples.

  6. Python String capitalize() Method - W3Schools

    The capitalize() method returns a string where the first character is upper case, and the rest is lower case.

  7. 5 Best Ways to Convert a Python List to Uppercase

    Feb 20, 2024 · List comprehension in Python provides a concise way to apply an operation to the elements in a list. Using list comprehension to convert a list of strings to uppercase is efficient and considered more “Pythonic” than using a …

  8. Python – Convert case of elements in a list of strings

    Dec 30, 2024 · In Python, we often need to convert the case of elements in a list of strings for various reasons such as standardizing input or formatting text. Whether it’s converting all characters to uppercase, lowercase, or even …

  9. Python Convert String List to Uppercase – Be on the Right

    Oct 21, 2022 · A concise Python one-liner to convert a string list to all uppercase strings is to use the map() function with a lambda function as a first argument — converting a string argument x …

  10. python - How to capitalize each word of a given list of strings ...

    Jun 23, 2018 · How to capitalize each word of a given list of strings? I need to satisfy this test: assert ["James"] == capitalize_names(["JAMES"]) assert ["Harry", "Jack"] == …

  11. Some results have been removed
Refresh