How to convert all characters of a string to lowercase in Python

Conversion of String Characters to Lowercase in Python

In Python, you can convert all charcters of a string to lowercase using the str.lower() method.

Converting all characters of a string to lowercase using 'str.lower()' method

1. Create a variable named str_variable and assign string value "Python iS A proPramming Language." to the variable.

2. Apply the lower() method to the string variable str_variable. This method converts all characters of the string to lowercase. Store the result in a new variable called lower_string.

Please take a closer look at the following example:

Example of using lower() method

Output of the above example
python is a propramming language.

Live Code Playground

In the following Python code editor, you can practice the above code by creating more string variables and converting their characters to lowercase using lower method. Click on the 'Execute Code' button to execute the code; the executed output will be displayed in the following Python Code Output frame. Practice until you become comfortable and proficient with your code.

Python logo Python Online Editor
Python Code Output