在python中,我可以使用index
查找元素的索引,例如:
# vowels list
vowels = ['a', 'e', 'i', 'o', 'i', 'u']
# index of 'e'
index = vowels.index('e')
print('The index of e:', index)
# index of the first 'i'
index = vowels.index('i')
print('The index of i:', index)
DolphinDB中是否有等效功能?
使用函数find
获取向量中元素的索引。如果该元素不存在,则返回-1。
vowels = ['a', 'e', 'i', 'o', 'i', 'u']
index = vowels.find('e')