Python String isupper() Method
The isupper()
method checks whether all the characters of a given string are uppercase or not. It returns True if all characters are uppercase and False even if one character is not in uppercase.
Symblos and numbers are not affected by this function
Syntax:
str.isupper()
Parameters:
None
Return Value:
Returns True if all characters are uppercase, else returns False.
The following eample checks whether the given string is in uppercase or not.
>>> mystr = 'HELLO WORLD'
>>> mystr.isupper()
True
>>> mystr = 'Hello World'
>>> mystr.isupper()
False
>>> mystr = 'hello world'
>>> mystr.isupper()
False
>>> mystr = 'PYTHON IS #1'
>>> mystr.isupper()
True
The isupper()
method always returns false if a given string contains only symbols or numbers but not alphabats.
>>> mystr = '#1?><~()+=*-+./\[]'
>>> mystr.isupper()
False
A string must contain at least one alphabat char.
>>> mystr = '#1?~()+=*-+./\[] THIS IS UPPER CASE'
>>> mystr.isupper()
True