Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3841594
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T15:40:29+00:00 2026-05-19T15:40:29+00:00

If I have a series of lists in a dictionary (for example): {‘Name’: [‘Thomas’,

  • 0

If I have a series of lists in a dictionary (for example):

{'Name': ['Thomas', 'Steven', 'Pauly D'], 'Age': [30, 50, 29]}

and I want to find the strings position so I can then get the same position from the other list.

So e.g.

if x = 'Thomas' #is in position 2:
    y = dictionary['Age'][2]
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T15:40:29+00:00Added an answer on May 19, 2026 at 3:40 pm
    i = dictionary['Name'].index('Thomas')
    y = dictionary['Age'][i]
    

    However, index performs a linear search, which could be slow for a large list. In other cases similar to this, I’ve used a pattern like this:

    Person = collections.namedtuple('Person', ['Name', 'Age'])
    dictionary = {'Thomas': Person('Thomas', 30), 'Steven': Person('Steven', 50), 'Pauly D': Person('Pauly D', 29)}
    

    You could do the same thing with a dict if you needed the records to be different length. Either way, storing it like this will help accessing records be faster.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have some series on un-order lists, wrapped with <a href=#>Link</a> I want show
I have an XML file that lists a series of items, and the items
I have a series of tables which I want to all have an order
I have a series of strings, which are two numbers: 1.782-100.799 -18.107-102.016 -17.504104.059 How
i have a series of select lists, that i am using to populate text
I have a series of lists that looks like this: li1 = ['a.1', 'b.9',
We have a configuration file that lists a series of regular expressions used to
How do I build a dict using list comprehension? I have two lists. series
I want to have the HighChart update the series by added the next data
Ok, I have a series of Unordered Lists on a page I am working

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.