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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:59:33+00:00 2026-05-20T18:59:33+00:00

I received a list when inputting the following URL – http://api.twitter.com/1/trends/44418.json The list contains

  • 0

I received a list when inputting the following URL – http://api.twitter.com/1/trends/44418.json

The list contains multiple dictionaries, and I’m a bit confused with the list structure. I’m trying to obtain the values associated with the ‘name’ key.

For example:

“name”:”#throwagrenade”
“name”:”Rebecca Black”
“name”:”#questionsihate”

I can write the code myself, I’m just trying to conceptually understand how to access dictionaries (and their key/value pairs) within a list.

  • 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-20T18:59:34+00:00Added an answer on May 20, 2026 at 6:59 pm

    The first thing I would do when working with a big lump of json, is try to get it into a more readable format. This online json formatting tool should do the job.

    Here’s some code that will get all the trend names:

    import urllib2
    import json
    
    url = 'http://api.twitter.com/1/trends/44418.json'
    
    # download the json string
    json_string = urllib2.urlopen(url).read()
    
    # de-serialize the string so that we can work with it
    the_data = json.loads(json_string)
    
    # get the list of trends
    trends = the_data[0]['trends']
    
    # print the name of each trend
    for trend in trends:
        print trend['name']
    

    Or you can do it all in one line:

    names = [trend['name'] for trend in the_data[0]['trends']]
    
    for name in names:
        print name
    

    Both will result in:

    #throwagrenade
    Rebecca Black
    Eric Abidal
    #questionsihate
    #juniordoctors
    Smiley Culture
    Lily Allen
    Wes Brown
    Pandev
    Ray Wilkins
    

    Relevant reading:

    Python docs on json (although you should only really need json.loads())

    Dive Into Python‘s sections on lists and dictionaries.

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

Sidebar

Related Questions

I have a list of JSON objects (received from a nosql db) and want
I have a list of grades that students received. Each student appears multiple times
Basically i received an API SOAP response of a list of categories in an
I received a list of numbers in Custom format (Type: 000000) that represent military
I received this reply on the Live555-mailing list: FEC is not needed for UDP.
I want to list messages that received specific user from other users group by
I want to get sms list, which are sent, received, drafts in iPhone device
I am getting a list of customer names from an API. I have about
i'm trying to populate a <mx:List> with a dataProvider that i received from a
I received the following email today from a co-worker. My question is this accurate.

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.