Sometimes one may require to convert a string to Python lowercase. There is also sometimes a need to check if the character in a string is lowercase or not. Python Programming Language has two types of built-in string methods that are basically used for string handling purposes, i.e., lower() and isLower()
The lower( ) method will convert the uppercase letters into the lowercase letters in strings. This function takes no arguments and converts the given string to lowercase strings. In this case, if there are no uppercase characters in the given string, then the lower( ) function returns the original string. It ignores the capital letters.
The isLower( ) method is used to check if the alphabetic or alphanumeric characters are all lowercase characters in a given string and return True or False.
The lowercase methods are used in the areas like email addresses, where all characters should be lowercase characters.
In this tutorial, the lowercase method in Python will be explained with the help of interesting examples.
The tutorial contains Code snippets along with the output snapshots of code for a better understanding.
Table of Contents
Python lower() Method
The lower( ) method in Python is a string’s method. It converts characters in a Python string to lowercase characters. The method takes no argument. Numbers and special characters are left unchanged. It has a very simple syntax.
Example Code. 01:
Let’s start with a simple block of code example.
txt = "convert it TO LOWERCASE"
s = txt.lower()
print(s)
Output:

Example Code. 02:
This example will help to understand the use of lower( ) method in a program.
firstString= “WEATHER IS LOVELY!”
secondString= “WeaTHer iS LOvElY!”
if (firstString.lower( ) == secondString.lower( )):
print( “The strings are same.”)
else:
print( “The strings are not same.”)
Output:

Python isLower() Method
This function of Python returns True or False by evaluating whether all characters in the given string are lowercase or not. Numbers, Spaces, and non-alphabetical characters are not considered. The syntax is shown in the examples.
Example Code. 01:
txt = "python school”
x = txt.islower()
print(x)
Output:

Example Code. 02:
a = "Miss world!"
b = "count 123"
c = "weareCodeleaks"
print(a.islower())
print(b.islower())
print(c.islower())
Output:

CONCLUSION
The Python lower( ) method is used to convert a string into a lowercase letters. The isLower( ) method is used for checking whether the string is in lowercase or not. It can be used in cases like before converting the string in lowercase, it may get checked for lowercase characters first.
Read Also: