To get the index of an item in an array in Python, you can use the index method on the array with the item as an argument. Here's an example:
main.py107 chars4 lines
In this example, the index method is used to get the index of the string "banana" in the my_array list. The index number is then printed to the console, which will output 1, since "banana" is the second item in the array (with an index of 1, since array indexes start at 0 in Python).
gistlibby LogSnag