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

  • Home
  • SEARCH
  • 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 9215669
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:15:21+00:00 2026-06-18T02:15:21+00:00

I did some research on how to use named array from PHP in python,

  • 0

I did some research on how to use named array from PHP in python, while i found the following code example as they said can be done with dictionary.

shows = [
   {"id": 1, "name": "Sesaeme Street"},
   {"id": 2, "name": "Dora The Explorer"},
]

Source: Portion of code getting from here

Reference: Python references

But how could i adding a new value through a loop? While the references shown on how to adding single value by simply shows[‘key’]=”value” but i can’t linking both of them. Can anyone please show me how to add the value into this dictionary through a loop?

For example:

for message in messages: 
            myvariable inside having two field
            - Message
            - Phone number

Update
May i know how could i loop them out to display after aped list into dictionary? Thanks!

  • 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-18T02:15:22+00:00Added an answer on June 18, 2026 at 2:15 am

    You should be adding the dictionary into an array like :

    friends = []
    for message in messages:
      dict = {"message" : message.message, "phone" : message.phone }
      friends.append(dict)
    

    to loop again, you can do it this way :

    for friend in friends:
      print "%s - %s" % (friend["message"], friend["phone"])
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I did some research and found that the only way to vertically center a
I did some research and I think the error is due to use of
I have a small application that I wrote in python. Did some research on
I did some research but all I could find was syncing data core with
I did some research but couldn't find the answer I was looking for so
I did some research but cannot find a definite approval or disapproval. What I
I did some research into the easiest/best way to generate a pdf in my
Did some searches here & on the 'net and haven't found a good answer
Why did some processor manifacturers decide to use Little endian Big endian Middle endian
I am getting into GUI programming and did some research. Now not everything is

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.