Python isupperを使って文字列が全て大文字であるかを判定する

環境
Python 3.9.13
Windows 10 Home 64bit
PyCharm 2022.2.1 (Community Edition)

構文
文字列.isupper()
isupperを使用すると、文字列が全て大文字であるかを判定します。

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
print( "arkgame".isupper() )
print( "ARKGAME".isupper() )
print( "arkgame".isupper() ) print( "ARKGAME".isupper() )
print( "arkgame".isupper() )

print( "ARKGAME".isupper() )

実行結果
False
True

Python

Posted by arkgame