Try the following code: ["foo", "bar", "baz"].index("bar") Refer to *[Python List index()][1]*. [1]: https://www.programiz.com/python-programming/methods/list/index