【Pythonエラー】TypeError: ‘>’ not supported between instances of AAA and BBB

Pythonで「TypeError: ‘>’ not supported between instances of AAA and BBB」というエラーが出た場合の対策をまとめました。

## 【エラー対策】比較対象のデータ型が異なる

Pythonで以下のようなエラーメッセージが出ることがあります。

TypeError: '>' not supported between instances of AAA and BBB

これは、比較演算子で比較を行っている2つの値の型が「AAA型」と「BBB型」で異なっているというエラーです。
そのため、比較する両方の値のデータ型を同じにすればエラーが解消されます。

関連記事
【Python入門】サンプル集
Python
スポンサーリンク

コメント