「Python入門」配列の要素のインデックスを取得する
サンプルコード
cft = ['a', 'b', 'new', 'D', 'z', 'example', 'new', 'two', 'elements']
print cft.index("example")
print cft.index("new")
print cft.index("z")
print "c" in cft
結果
5
2
4
False
Coding Changes the World
サンプルコード
cft = ['a', 'b', 'new', 'D', 'z', 'example', 'new', 'two', 'elements']
print cft.index("example")
print cft.index("new")
print cft.index("z")
print "c" in cft
結果
5
2
4
False