Python String | isupper method
Start your free 7-days trial now!
str.isupper(~) method returns a
boolean indicating whether all cased characters in a string are uppercase. Note that when the string contains only special characters
False is returned.
boolean indicating whether all the cased characters in a string are uppercase.
When all the cased characters are not uppercase:
x = 'SkyTowner'x.isupper()False
When all the cased characters are uppercase:
y = 'SKYTOWNER'y.isupper()True
When all the characters are special characters or numbers:
z = '123'z.isupper()False
When the string is a mix of special characters and uppercase characters:
a = '123A'a.isupper()True
Note that the
isupper() method only checks whether all cased characters are uppercase and disregards non-cased characters such as numbers.