Python String islower() Function
The String islower()
method returns True
if the string is not empty and all the alphabet characters are lowercase. Otherwise, it returns False
.
Syntax
my_string.islower()
islower() Parameters
Python String islower()
function does not take any parameters.
islower() Return Value
Python String islower()
function returns:
True
if all characters in the string are lowercase.False
if the string does not contain at least one cased character or if the string contains at least one uppercase alphabetic character.
Examples
Example 1: Check if all characters in the string are lowercase
The islower()
method returns True
if all characters in the string are lowercase.
my_str = 'abcd'
result = my_str.islower()
print(result) # Output: True
output
True
The method returns False
, if the string does not contain at least one cased character.
my_str1 = '123$@%'
my_str2 = 'a123$@%'
print(my_str1.islower()) # Output: False
print(my_str2.islower()) # Output: True
output
False
True
The method also returns False
, if the string contains at least one uppercase alphabet.
my_str = '123A$@%'
print(my_str.islower()) # Output: False
output
False
Example 2: Check if an Empty String is lowercase
An empty string is not lowercase.
my_str = ''
print(my_str.islower()) # Output: False
output
False