How to Use String islower() Method in PythonPython Basics


The str.islower() method checks if all the letters in a string are lowercase. If yes, the string is considered to be lower case.

Example

#!/usr/bin/python3
# -*- coding: UTF-8 -*-

str1 = 'abcdefg'
str2 = 'abc.!123 ' 
str3 = 'abcDeFg'

print (str1.islower())
print (str2.islower())
print (str3.islower())

Output:

True
True
False

Syntax

str.islower()

Parameters

The method doesn’t take any parameters.

Return Value

It returns true and false, depending on whether the string is lowercase or not.

© 2024 Learnwithgpt.org, all rights reserved. Privacy Policy | Contact Us