Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
私はPythonが初めてで、要素が配列に存在するかどうかを教えてくれる標準関数を探しています。メソッドは見つかりましたindexが、要素が見つからない場合は例外がスローされます。true要素が配列内にあるかどうかに関係なく返される単純な関数が必要falseです。
index
true
false
基本的に PHP と同等in_arrayです。
in_array
>>> 1 in [0, 1, 2, 3, 4, 5] True