islower()

my_str.islower()
Returns True if all chars in a string are in lower case, otherwise returns False
my_str='_abc45'
print(my_str.islower())     # Output is True

my_str='ab#cd'
print(my_str.islower())     # Output is True

my_str='A_abc1234'
print(my_str.islower())     # Output is False

my_str='pq?rs'              
print(my_str.islower())     # Output is True

my_str='pq rs'              
print(my_str.islower())     # Output is True

my_str='12ab'              
print(my_str.islower())     # Output is True

Handling Special Characters and Numbers

islower() ignores numbers and special characters, focusing only on alphabetic characters:

my_str = 'hello_123!'
print(my_str.islower())
True

Use Case: Validating User Input

We can use islower() to validate user input that must be in lowercase:

user_input = 'securepassword'
if user_input.islower():
    print("Valid input.")
Valid input.

Checking Mixed Case Strings

islower() returns False if the string contains uppercase letters:

text = 'Hello world'
print(text.islower())
False

Checking Empty Strings

For an empty string, islower() returns False because there are no lowercase characters to check:

empty_str = ''
print(empty_str.islower())
False

Handling Multilingual Text

islower() works with non-ASCII characters:

text = 'maƱana'
print(text.islower())
True


All String methods isupper()


Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com







    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer