python

针对数组的index()方法可以返回指定值首次出现的位置

fruits = ['apple', 'banana', 'cherry']
x = fruits.index("cherry")