Python String islower() Method
The Python islower() method is a string method that returns True if all alphabets in a string are lowercase alphabets and there is at least one alphabet, otherwise False. The method does not check for symbols or numbers.
Here are some examples of using the islower() method:
# Example 1: A simple example of lowercase testing using islower() method[^3^][1]
# Check if all characters in the string are lowercase
S = 'abcd'
x = S.islower()
print(x)
# Prints True
# Example 2: The islower() method will return False if the string contains any uppercase alphabet[^1^][2] [^4^][4]
txt = "Hello world!"
x = txt.islower()
print(x)
# Prints False
# Example 3: The islower() method will return False if the string contains only symbols or numbers but not alphabets[^2^][3]
mystr='#1?><~ ()+=*-+./\\ []'
print(mystr.islower())
# Prints False
If you have any questions about this code, you can drop a line in comment.
Comments
Post a Comment