python get index of item in 2d list

myList = [[1, 2], [3, 4], [5, 6]]


def index_2d(myList, v):
    for i, x in enumerate(myList):
        if v in x:
            return i, x.index(v)


print(index_2d(myList, 3))
# you get
# (1, 0)

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
python find index of element in 2d array python find index in 2d list find index of value in 2d array python find index in 2d array python finding index of 2D list reaching index of elements in 2D list python find index of a row in 2d array python find index of a 2d array python inbuilt funtion find the index of an element in a 2d list python find the index of an element in a 2d list python python get all index value in 2d array to find index of element in 2D array python find index of array in 2d array python get index of element in 2d list python python find index of value in 2d array find position of element in 2d list python python how to find index of an element in a 2d list get position of value in 2D array python how to get index from 2d array python get index of 2d array python how to get the index of a 2d list in python how to get index of element in a 2d list python how to find the index of an element in a 2d list in python python 2d list find index how to find the index of an element in a 2d' list in python get inde for element in 2d list get index of item in 2d list python get index of element in 2d array python find index of element in 2d array python Find index of element in 2D list Python how to get index of 2d array in python find index of element in 2dlist python python get index of item in list get index of an element in a list python 2d item list python 2d list get index index of value in double list python python list 2d index how to get second value in 2 d list python python get index of item in 2d list
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source