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 8251379
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:13:00+00:00 2026-06-08T00:13:00+00:00

This is a long question so please bear with me. I start out with

  • 0

This is a long question so please bear with me. I start out with 3 dicts obtained from 3 APIs. the dicts have a structure like so:

API1 = {'results':[{'url':'www.site.com','title':'A great site','snippet':'This is a great site'},
{'url':'www.othersite.com','title':'Another site','snippet':'This is another site'},
{'url':'www.wiki.com','title':'A wiki site','snippet':'This is a wiki site'}]}

API2 = {'hits':[{'url':'www.dol.com','title':'The DOL site','snippet':'This is the dol site'},
{'url':'www.othersite.com','title':'Another site','snippet':'This is another site'},
{'url':'www.whatever.com','title':'Whatever site','snippet':'This is a site about whatever'}]}

API3 = {'output':[{'url':'www.dol.com','title':'The DOL site','snippet':'This is the dol site'},
{'url':'www.whatever.com','title':'Whatever site','snippet':'This is a site about whatever'},
{'url':'www.wiki.com','title':'A wiki site','snippet':'This is a wiki site'}]}

I extract the URL keys from API1, API2 and API3 to do some processing. I do this because there is quite a bit of processing to be done and only the URLs are needed. When finished I have a list of the URL’s with the duplicates removed and another list of scores that are relative to each URL’s position in the list:

URLlist = ['www.site.com','www.wiki.com','www.othersite.com','www.dol.com','www.whatever.com']

Results = [1.2, 6.5, 3.5, 2.1, 4.0]

What I have done is created a new dictionary from these 2 lists using the zip() function.

ScoredResults = dict(zip(URLlist,Results))

{'www.site.com':1.2,'www.wiki.com':6.5, 'www.othersite.com':3.5, 'www.dol.com':2.1, 'www.whatever.com':4.0}

Now what I need to do is to link the URL’s from ScoredResults with API1,API2 or API3 so that I have a new dictionary like so:

Full Results = 
{'www.site.com':{'title':'A great site','snippet':'This is a great site','score':1.2},
 'www.othersite.com':{'title':'Another site','snippet':'This is another site','score':3.5},
...}

This is too difficult for me to do. If you look back on my question history I have been asking numerous dictionary questions but no implementation has worked so far. If anyone could please point me in the right direction I would very much appreciate it.

  • 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-06-08T00:13:01+00:00Added an answer on June 8, 2026 at 12:13 am

    A quick attempt:

    from itertools import chain
    
    full_result = {}
    
    for blah in chain.from_iterable(d.itervalues() for d in (API1, API2, API3)):
        for d in blah:
            full_result[d['url']] = {
                'title': d['title'],
                'snippet': d['snippet'],
                'score': ScoredResults[d['url']]
            }
    
    print full_result
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is a bit long, please bear with me. In REST, i think
This will be quite a long way to ask my question, so please bear
This is a bit of a long question so please bear with me guys.
This is a long text. Please bear with me. Boiled down, the question is:
Firstly, This might seem like a long question. I don't think it is... The
This question has been puzzling me for a long time now. I come from
This is a pretty newbie question- please know I'm aware of that. I have
It's a long question but not too complicated so please bear with me. I'm
I know this is a long post, but please bear with me :) Currently
First off, please forgive the stupidness of this question but Im not from a

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.