tuple find python code example
Example 1: how to search tuple values in a list in python
test = [("hi", 1), ("there", 2)]
test = dict(test)
print test["hi"] # prints 1
Example 2: searching in a tuple python
# vowels tuple
vowels = ('a', 'e', 'i', 'o', 'i', 'u')
# element 'e' is searched
index = vowels.index('e')
# index is printed
print('The index of e:', index)
# element 'i' is searched
index = vowels.index('i')
# only the first index of the element is printed
print('The index of i:', index)