IT Learning

実践形式でITのお勉強

Python

【Python】Falseのチェック方法

投稿日:

Bool型のFlaseはnotで調べることができる。

>> not 0

True

>> not {}

True

>> not []

True

>> not set()

True

>> not  None

True

>> not ''

True

Noneもnot演算子ではTrue判定で返される。

>> not None
True

結構使いどころはありそうなので覚えておく。

Related

-Python

執筆者:


comment

メールアドレスが公開されることはありません。 が付いている欄は必須項目です